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

Re: ID Generation for XML Element

Subject: Re: ID Generation for XML Element
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 29 Oct 2010 13:58:57 +0200
Re:  ID Generation for XML Element
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:template match="body/sect/sect">
<xsl:variable name="pos"><xsl:number level="any"/></xsl:variable>
<sect2 id="sect{$pos}">
and so on for the other levels.


	Martin Honnen

Current Thread


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.
First Name
Last Name
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.