[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Referencing unique values by their order number.
> I do not have a separate file - and I'd rather avoid it. ah ok, time to bring out keys then (google for muenchian grouping) <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:key name="i" match="item" use="."/> <xsl:template match="x"> <a> <items> <xsl:copy-of select="item[generate-id()=generate-id(key('i',.))]"/> </items> <elements> <xsl:for-each select="text"> <element> <item> <xsl:value-of select="count(key('i',preceding-sibling::item[1])[1]/preceding-sibling::item[generate-id()=generate-id(key('i',.))])"/> </item> <xsl:copy-of select="."/> </element> </xsl:for-each> </elements> </a> </xsl:template> </xsl:stylesheet> <a> <items> <item>V1</item> <item>V2</item> <item>V3</item> </items> <elements> <element> <item>0</item> <text>(content)</text> </element> <element> <item>0</item> <text>(content)</text> </element> <element> <item>1</item> <text>(content)</text> </element> <element> <item>0</item> <text>(content)</text> </element> <element> <item>2</item> <text>(content)</text> </element> <element> <item>2</item> <text>(content)</text> </element> </elements> </a>
|
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
|