EXSLT - exsl:node-set

Implementer Page: exsl.node-set.html
Function Package: exsl.node-set.zip

Function Syntax

node-set exsl:node-set(object)

The exsl:node-set function returns a node-set from a result tree fragment (which is what you get when you use the content of xsl:variable rather than its select attribute to give a variable value). This enables you to process the XML that you create within a variable, and therefore do multi-step processing.

You can also use this function to turn a string into a text node, which is helpful if you want to pass a string to a function that only accepts a node-set.

Implementations

The following XSLT processors support exsl:node-set:

The following processors support earlier versions of exsl:node-set:

There are currently no third-party implementations of exsl:node-set.

Examples

Function

This use case shows the result of using exsl:node-set() to convert a result tree fragment to a node-set.

Source

<doc>
   <one />
   <two />
   <three />
   <four />
</doc>

Stylesheet

<!--  Test exslt:node-set applied to a result tree fragment  -->
<xsl:variable name="tree">
   <a>
      <b>
         <c>
            <d />
         </c>
      </b>
   </a>
</xsl:variable>
<xsl:template match="/">
   <out>
      <xsl:value-of select="count(exslt:node-set(//*))" />
   </out>
</xsl:template>

Result

<out xmlns:exslt="http://exslt.org/common">5</out>

http://www.exslt.org/exsl/functions/node-set/index.html last modified 2002-11-12