Integer list : list type « XSLT stylesheet « XML






Integer list



File: Transform.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="2.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xsl:output method="text"/>
 
  <xsl:variable name="some-numbers" as="xs:integer*" select="1 to 5"/>

  <xsl:variable name="reversed-numbers" as="xs:integer*" select="reverse(1 to 5)"/>

  <xsl:template match="/">
    <xsl:value-of select="$some-numbers" separator=", "/>
    <xsl:text>&#xA;</xsl:text>
    <xsl:value-of select="$reversed-numbers" separator=", "/>
  </xsl:template>

</xsl:stylesheet>

Output:

1, 2, 3, 4, 5
5, 4, 3, 2, 1

 








Related examples in the same category

1.Variable of string list