[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Subject: Counting Path Occurrences

Subject: RE: Subject: Counting Path Occurrences
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 4 Apr 2007 08:28:11 +0100
RE:  Subject: Counting Path Occurrences
> > 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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.