creating and retrieving a sequence

Here should go questions about transforming XML with XSLT and FOP.
Posts: 1
Joined: Wed Jun 10, 2015 8:14 pm

creating and retrieving a sequence

Post by cshrileckha » Wed Jun 10, 2015 8:19 pm

Hello oxygen team,

I have a requirement where I need to create a sequence starting from 2000...3000
and I need to retrieve the sequence in that order.
Suppose I retrieve the sequence now. It should display 2000 and when next time I retrieve it, it should display 2001. is this possible in XSLT?


Posts: 2648
Joined: Tue May 17, 2005 4:01 pm

Re: creating and retrieving a sequence

Post by adrian » Thu Jun 11, 2015 11:33 am


So, you are referring to a range of sequential numbers. If you need the actual sequence, you can simply use "2000 to 3000" in an XPath.
e.g. in a variable

Code: Select all

<xsl:variable name="sequence" select="2000 to 3000"/>
Or, you can use xsl:for-each to iterate over it:

Code: Select all

<xsl:for-each select="2000 to 3000">
<xsl:value-of select="."/>
"." is the current context that within the for-each block holds the currently iterated number, 2000, 2001, and so on.

Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Post Reply