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>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--