Re: [xsl] Context document with exsl:node-set()?

Subject: Re: [xsl] Context document with exsl:node-set()?
From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Nov 2007 20:55:21 +0000
On Thu, Nov 01 2007 19:32:24 +0000, Scott.Trenda@xxxxxxxx wrote:
> I think I was trying to ask, is the template content of a variable
> treated as its own document? It would make sense if it were,
> considering

XSLT 1.0 [1] says:

   A result tree fragment represents a fragment of the result tree. A
   result tree fragment is treated equivalently to a node-set that
   contains just a single root node.

EXSLT [2] says:

   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).

XPath 1.0 [3] says:

   XPath operates on an XML document as a tree.

and [4]:

   The root node is the root of the tree.

> it's possible to create new nodes within it, rather than creating a set

RTF nodes are not node-set nodes.

You're not creating node-set datatype nodes until you use
exsl:node-set() to turn the RTF into a node-set (or you use xsl:copy-of
to copy the RTF to the result tree).

About all you can do with an RTF as an RTF is use its string value.

> of references to nodes in the original document when @select is used.
> Then exsl:node-set() essentially acts like document(), correct? I think
> I was getting confused because I started out making copies of the nodes
> in the template content.

The result of exsl:node-set() has the same general structure as a
document in that it has one root node, but that root node could have
multiple element node children (unlike an XML document).

Regards,


Tony Graham.
======================================================================
Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx   http://www.menteithconsulting.com

Menteith Consulting Ltd             Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
----------------------------------------------------------------------
Menteith Consulting -- Understanding how markup works
======================================================================

[1] http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
[2] http://www.exslt.org/exsl/functions/node-set/index.html
[3] http://www.w3.org/TR/xpath#data-model
[4] http://www.w3.org/TR/xpath#root-node

Current Thread