Ok,
I need to be able to count the # of items for each category and have it display.
So say i have a left menu that displays that category name for cat in the current issue.xml for instance en_print_200802 .xml which is called form a seperate .xml volissue.xml beside each name i want to display the # of items in each category.
XSL
Thanks,
B.
I need to be able to count the # of items for each category and have it display.
So say i have a left menu that displays that category name for cat in the current issue.xml for instance en_print_200802 .xml which is called form a seperate .xml volissue.xml beside each name i want to display the # of items in each category.
Code:
<?xml version="1.0" encoding="utf-8"?> <vol_issue vol_issue_id="200802"> <description>February</description> <language>en</language> <type>print</type> <xmlfilename>en_print_200802.xml</xmlfilename> <cdfilename>cd_en_print_200802.xml</cdfilename> <category category_id="2"> <sort_order>2</sort_order> <article article_id="48633"/> </category> <category category_id="1"> <sort_order>3</sort_order> <article article_id="48105"/> <article article_id="48104"/> <article article_id="48103"/> <article article_id="48102"/> <article article_id="48101"/> </category>
Code:
<xsl:variable name="category_lookup" select="document('../articles/categories.xml')"/>
<xsl:template match="vol_issue">
<xsl:choose>
<xsl:when test="$target = 'web'">
<div class="ln-text">
<xsl:for-each select="category">
<xsl:sort select="sort_order" data-type="number" order="ascending" />
<xsl:variable name="catid" select="@category_id"/>
<xsl:variable name="classname">
<xsl:choose>
<xsl:when test="$catid = $selectedcat"><xsl:text>ln-slink</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>ln-alink</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text>•*</xsl:text><a href="{$strBaseURL}&vol={/vol_issue/@vol_issue_id}&cat={$catid}" id="{$catid}" class="{$classname}"><xsl:value-of
select="$category_lookup/main/category[@category_id = $catid]/description"/>: <!-- <xsl:value-of select="document('vol_issue/@vol_issue_id.xml')//count(value)"/> -->
</a><br/>
</xsl:for-each>
</div>
</xsl:when>
<xsl:otherwise>
<input type="hidden" name="lang" value="{language}"/>
<input type="hidden" name="type" value="{type}"/>
<input type="hidden" name="vol_issue_id" value="{@vol_issue_id}"/>
<xsl:for-each select="category">
<xsl:sort select="sort_order" data-type="number" order="ascending" />
<xsl:variable name="catid" select="@category_id"/>
<input type="checkbox" name="cat" value="{$catid}"><xsl:value-of select="$category_lookup/main/category[@category_id = $catid]/description"/></input><br/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
B.
Comment