Page 1 of 1

creating and retrieving a sequence

Posted: Wed Jun 10, 2015 8:19 pm
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.

Re: creating and retrieving a sequence

Posted: Thu Jun 11, 2015 11:33 am
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