Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incremental count ?

Status
Not open for further replies.

sheila11

Programmer
Dec 27, 2000
251
US
Hi all,

I have an xml file that can contain any number of Ordered Lists. I need to add text at the begining of each list, that will specify what's the number of that list.

I understand that we can't increment a variable in XSLT. Is there any work around this ? I noticed a thread ( ) where a solution is advised by Avator, to a similar question.
But my problem is that the Lists can occur anywhere in my XML.

Any pointers/advice ?
TIA,
Sheila
 
Try this:
Code:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="ol">
    <ol>
      <mypos><xsl:value-of select="position()"/></mypos>
      <xsl:copy-of select="*"/>
    </ol>
  </xsl:template>
</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top