[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSLT transformation using counters

Subject: XSLT transformation using counters
From: Bubba O'Reily <killswi7ch1@xxxxxxxx>
Date: Tue, 26 Apr 2011 11:28:16 -0400
 XSLT transformation using counters
Hi,

I can't seem to get a handle on how to set a counter or variable then then
output the results. I have a XML file (snippet) tagged like so:


Input:

<body>

<lev>
<hd>heading</hd>

    <lev>
    <hd>heading</hd>

        <lev>
        <hd>heading</hd>

            <lev>
            <hd>heading</hd>

            </lev>

        </lev>

    </lev>

</lev>

</body>


How can I set a counter and insert the results in the <HD?> tag below?

Output:

<body>

<lev>
<hd1>heading</hd>

    <lev>
    <hd2>heading</hd>

        <lev>
        <hd3>heading</hd>

            <lev>
            <hd4>heading</hd>

            </lev>

        </lev>

    </lev>

</lev>

</body>


<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="div">
<xsl:text
disable-output-escaping="yes">&#13;&#10;&lt;ParaStyle:div&gt;</xsl:text>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="div">
<xsl:text
disable-output-escaping="yes">&#13;&#10;&lt;ParaStyle:div&gt;</xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="heading">
<xsl:text
disable-output-escaping="yes">&#13;&#10;&lt;ParaStyle:hd1&gt;</xsl:text>
<xsl:apply-templates/>
</xsl:template>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.