[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] sequential numbering in xslt
Hi: I cannot post the input , output and XSLT since they are too big and complicated, So I apologize and will try to explain my problem conceptually. I have a number of XML files as input, and I transform them into another XML format using XSLT. The output XML file has a schema and has a required 'seq' attribute in the root element that needs to be incremented for each input XML file. So, for example, if I had 5 input xml files a.xml, b.xml, c.xml, d.xml, e.xml, and I transformed them into Aout.xml, Bout.xml, Cout.xml, Dout.xml and Eout.xml , the output of which looks something like below: Output XML: <car seq="1"> <req>....<req> <body id="c1"> </body> </car> for every input file, in the transformation, I want to increment attribute 'seq' in the output file by 1 when I transform the input files using xslt. I have tried <xsl:number> and tried writing a function. But the problem is that since variables in xslt are constants, there is no way to increment a number, store it in a temp variable and increment it for the next time in xslt 2.0 unlike procedural languages like C or C++. Is there any other way of achieving this in XSLT 2.0? Please advise on any other approach. Thanks in advance.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|