Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the answer to your question is, yes. You <strong>can</strong> send a node to an XSLT function.</p> <p>If you are wondering what to use for the value of the as="" attribute, you have several choices. If you want to be very lax and accept just about anything, use <strong>as="item()*"</strong>. </p> <p><a href="http://www.dpawson.co.uk/xsl/rev2/exampler2.html#istar" rel="noreferrer">From David Pawson's site</a>:</p> <blockquote> <p>item()* .. sort of nodeset? W3C</p> <p>Yes, I agree it looks pretty meaningless doesn't it. However. As of CR, its pretty essential, especially if you want to use types. And want to generate, say, a nodeset.. sorry sequence, in a variable.</p> </blockquote> <pre><code>&lt;xsl:variable name="a" select="(//h3)[position() &lt; 3]" as="item()*"/&gt; </code></pre> <blockquote> <p>This creates a variable you can hack into using xpath quite readily. I.e. remember item()*.</p> <p>types ... a few examples. W3C</p> <p>From an explanatory email from Mike Kay, thanks Mike. Examples:</p> <p><code>&lt;xsl:param name="x" as="item()"/&gt;</code></p> <p>the parameter value can be any item (i.e. a node or atomic value). But it must be a single item.</p> <p><code>&lt;xsl:param name="x" as="item()?"/&gt;</code></p> <p>the parameter can be a single item or an empty sequence</p> <p><code>&lt;xsl:param name="x" as="item()+"/&gt;</code></p> <p>the parameter must be a sequence of one or more items - an empty sequence is not allowed</p> <p><code>&lt;xsl:param name="x" as="item()*"/&gt;</code></p> <p>the parameter can be any sequence of zero or more items - this places no constraints on its value.</p> <p><code>&lt;xsl:param name="x" as="node()*"/&gt;</code></p> <p>the parameter can be any sequence of zero or more nodes</p> <p><code>&lt;xsl:param name="x" as="xs:atomicValue*"/&gt;</code></p> <p>the parameter can be any sequence of zero or more atomic values (e.g. integers, strings, or booleans).</p> <p>item()* is the most general type possible, it matches everything, like "Object" in Java. For that reason, it can usually be omitted. But not always, for example the default type in xsl:variable is not item()* but document-node(), to ensure that</p> <p><code>&lt;xsl:variable name="rtf"&gt;&lt;a&gt;thing&lt;/a&gt; &lt;/xsl:variable&gt;</code></p> <p>continues to behave like XSLT 1.0</p> <p>Use these to specify parameters, variable types etc.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload