Loading TOC...

MarkLogic Server 11.0 Product Documentation
exsl:node-set

exsl:node-set(
   $value as item()*
) as node()*

Summary

Returns a sequence of nodes based on the input object. If the input is a sequence of nodes, it is returned as it is. If it is a node, it is simply returned as a singleton sequence. For all other atomic types, a text node is returned based on the string-value of the type. This was a useful function in XSLT 1.0 where "Result Tree Fragments" are returned as a result of xslt instruction. In XSLT 2.0, however, xslt instructions return sequences. This function is simply being provided for backward compatibility to existing applications.

Parameters
value The given object $value which needs to be converted into sequence.

Usage Notes

This function is based on the EXSLT functions (http://www.exslt.org/).

Example

xquery version "1.0-ml";

xdmp:xslt-eval(
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                   xmlns:exsl="http://exslt.org/common"
                   extension-element-prefixes="exsl"
                   version="2.0">
     <xsl:template match="/">
       <xsl:value-of select="count(exsl:node-set(//element()))" />
     </xsl:template>
   </xsl:stylesheet>
,
document{
 <doc>
   <one />
   <two />
   <three />
   <four />
</doc>})
  
=> 5
 

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.