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

Re: Unable to get text() of node

Subject: Re: Unable to get text() of node
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Sat, 21 Jan 2006 17:20:36 +0100
get text from node
../text() returns a node-set with multiple text nodes (if present), but the xsl:value-of instruction will copy the string value of only the first (text) node from the nodeset. This first text node is however the white-space before the childname element and not the character data after the childname element nor the character data inside the childname. text() returns all significant character data sequences directly under the context node, not those of child nodes.

You might want to try xsl:copy-of instead of xsl:value-of. That will copy all text nodes in the nodeset to the result tree, instead of only the first.

Regards,
Geert

Liron wrote:

Hi Mukul,

Thank you very much for your reply and indeed you're right but I must ask for an explanation.
I can see why text()[2] would get me the second text node for the <child> element but I tried to do the following after your reply:
<child>
<childname/>
name
</child>


1) The output was "name" which means that even though <childname> is empty, its content is still considered as text node (though empty). Is that the case?

2) How can I get the text of <child> without knowing his descendants?. Just the absolute text of it ("name" in this case). I thought that child:text() would do the trick but it didn't.

I'm really trying to understand this but a newbie is a newbie after all...

Thank you
Liron

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.