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

sequential numbering in xslt

Subject: sequential numbering in xslt
From: a kusa <akusa8@xxxxxxxxx>
Date: Sun, 3 Jan 2010 14:41:45 -0600
 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.

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.