its self explanatory:
structure code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<dynamic-element name="shortcontent" type="text_box" repeatable="false"/>
<dynamic-element name="content" type="text_area" repeatable="false"/>
<dynamic-element name="title" type="text_box" repeatable="false"/>
</root>
template code sample to extract data from structure:
<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:variable name="url" select="//request/render-url" />
<xsl:variable name="namespace" select="//request/portlet-namespace" />
<xsl:variable name="category">
<xsl:text>general</xsl:text>
</xsl:variable>
<xsl:variable name="community">
<xsl:text>@friendly_url_public@@group_friendly_url@</xsl:text>
</xsl:variable>
<xsl:variable name="language-id">
<xsl:text>@language_id@</xsl:text>
</xsl:variable>
<xsl:variable name="groupId">
<xsl:text>@group_id@</xsl:text>
</xsl:variable>
<xsl:variable name="structure-id">
<xsl:text>sai</xsl:text>
</xsl:variable>
<xsl:variable name="articles" select="document(concat('http://@portal_url@/c/journal/get_articles?templateId=',$structure-id,'&delta=5&languageId=',$language-id,'&type=',$category))/result-set/result" />
<br/>
<xsl:value-of select="$structure-id" /> -- <xsl:value-of select="$language-id" /> -- <xsl:value-of select="$category" />
<br/>
<xsl:for-each select="$articles">
<div style="background-color: #EEEEEE; font-family: Arial; font-size: 12pt;">
<xsl:value-of select="root/dynamic-element[@name='content']/dynamic-content" disable-output-escaping="yes" />
<xsl:value-of select="/root/dynamic-element[@name='shortcontent']/dynamic-content" disable-output-escaping="yes" />
<br/>
</div>
</xsl:for-each>
</html>
0 comments:
Post a Comment