Ramkumar.V wrote:
Below are the inputs. I need to generate sequential ID for all the sect
element including any nesting element sec/sec/sec for sec2 sec 3 sec4
<xsl:template match="sect">
<xsl:variable name="pos"><xsl:number/></xsl:variable>
Use
<xsl:variable name="pos"><xsl:number level="any"/></xsl:variable>
And instead of the xsl:choose and ancestor check you could simply write
different templates e.g.
<xsl:template match="body/sect">
<xsl:variable name="pos"><xsl:number level="any"/></xsl:variable>
<sect1 id="sect{$pos}">
<xsl:apply-templates/>
</sec1>
</xsl:template>
<xsl:template match="body/sect/sect">
<xsl:variable name="pos"><xsl:number level="any"/></xsl:variable>
<sect2 id="sect{$pos}">
<xsl:apply-templates/>
</sec2>
</xsl:template>
and so on for the other levels.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
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>
--~--