[Home] [By Thread] [By Date] [Recent Entries]
Greetings.
I've been using Jeni's method from the XSLT FAQ to assign unique id's to nodes. In order to speed things up, can anyone think of a way that I could store the running totals for the different nodes, rather than having to call the count() function repeatedly? A generalized method would obviously be the best, so that it could be applied to any arbitrary set of nodes, but I don't know if this is even possible. <xsl:template match="*">
<xsl:variable name="name" select="name()" />
<xsl:element name="{name()}">
<xsl:attribute name="id">
<xsl:value-of select="concat($name, '-',
count(preceding::*[name()= $name]) +
count(ancestor::*[name()= $name]))" />
</xsl:attribute>
<xsl:apply-templates />
</xsl:element>
</xsl:template>Thanks very much for any suggestions. Regards, Brian -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



