creating and retrieving a sequence

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

creating and retrieving a sequence

Post by cshrileckha »

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?

Thanks.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: creating and retrieving a sequence

Post by adrian »

Hi,

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="."/>
</xsl:for-each>
"." is the current context that within the for-each block holds the currently iterated number, 2000, 2001, and so on.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply