xsl-list
[Top] [All Lists]

RE: [xsl] Subject: Counting Path Occurrences

2007-04-04 00:28:40
Actually that function generates a sequence of text nodes.

That was the original source of my confusion.  :)  Is that 
because of the "for-each" over the ancestor-or-self axis?  


The select clause of the for-each is irrelevant. It's because the content of
the xsl:for-each is an xsl:value-of instruction. xsl:value-of constructs a
text node, therefore xsl:for-each constructs several text nodes.

If you use this construct inside another instruction such as a literal
result element, then the several text nodes will be concatenated. But used
directly within a function, there's no containing instruction to do the
concatenation, so the sequence of text nodes is returned as is.

Very often in 2.0 you should be using xsl:sequence rather than xsl:value-of.
The difference is that xsl:sequence returns the result of its select
expression unchanged, whereas xsl:value-of flattens it into a string and
then wraps that string in a text node.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>