xsl:sequence
Adds the items produced by an XPath expression to the current sequence — without converting them to text.
<xsl:sequence select="1 to 10"/>Unlike xsl:value-of, which always produces a text node, xsl:sequence preserves the original types and node identities. It is the right tool for returning typed values from xsl:function, building typed variables, or copying nodes by reference into a result sequence.
Attributes
| Attribute | Description |
|---|---|
select |
XPath expression producing the items to add. Required unless a sequence constructor body is given. |
Examples
Returning a typed value from a function:
<xsl:function name="my:double" as="xs:integer">
<xsl:param name="n" as="xs:integer"/>
<xsl:sequence select="$n * 2"/>
</xsl:function>Building an integer sequence:
<xsl:variable name="primes" as="xs:integer*">
<xsl:sequence select="2"/>
<xsl:sequence select="3"/>
<xsl:sequence select="5, 7, 11"/>
</xsl:variable>