xsl-list
[Top] [All Lists]

Re: [xsl] [string to node]

2010-02-22 03:46:40
On 22/02/2010 01:13, Syd Bauman wrote:
In both cases it seems as though $a contains only 1 thing, a
string. (You can test that it is not a node set by using $a in
the select= of a for-each -- you should get a runtime error,
since it is a string.)

No, it's a result tree fragment, not a string.

Oh, right. Thanks for the correction. (He says with his tail between
his legs.) But if I understand correctly, as a result tree fragment,
only those operations that can be performed on strings are permitted
(i.e., can't do path stuff or predicates), and you can't use a result
tree fragment as the value of select= of for-each (or apply-
templates, for that matter), because a result tree fragment is not a
node-set, even though when you do get to use one it behaves as node-
set. (And select= of for-each and apply-templates takes a node-set.)


Ken's covered most of the points but just to note that there are crucial differences between the result tree fragment and its string value.

While the operations you can do on an rtf are just those you can do on a string, the results of those operations are different:

xsl:copy-of on a string is the same as xsl:value-of, but xsl:copy-of on an rtf is copies of the underlying nodes.

If used in a boolean context a string is true just if it is non empty, but an rtf is always true 9as it corresponds to a document node)

exslt:node-set (and xalan:nodeset, saxon;node-set, msxsl:node-set, etc)
work with result tree fragments not strings.

Basically rtf in xslt1 is restricted in such a way that it could be extended in a future (at the time) version of xslt to act like a node set rather than a string.

David


David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>