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.)
And because a result tree fragment is always a "root" node (in this
case a single text() node), count($a) will always return 1, right?
Further, I think that if the variable is built using select= instead
of content, the variable is a node-set instead of a result tree
fragment, right? I.e.,
<xsl:variable name="a" select="//dd"/>
<xsl:value-of select="count($a)"/>
should return 3 (or however many <dd> were in the input instance).
But what then would
<xsl:value-of select="$a"/>
return? I just tried it on my test input, and it returned "one".
Hmm ...
--~------------------------------------------------------------------
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>
--~--