|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Newbie question: how to count equal nodes into one resul
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="/">
<result>
<xsl:apply-templates/>
</result>
</xsl:template>
<xsl:template match="tag">
<xsl:variable name="currentFruit"><xsl:value-of
select="."/></xsl:variable>
<xsl:variable name="others">
<xsl:number
expr="count(from-preceding-siblings(tag[from-self(*)=$currentFruit]))"/>
</xsl:variable>
<xsl:if test="$others=0">
<tag>
<value><xsl:value-of select="."/></value>
<occurred>
<xsl:number
expr="count(from-following-siblings(tag[from-self(*)=$currentFruit])) + 1"/>
</occurred>
</tag>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








