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

Re: Unanticipated Results from text()

Subject: Re: Unanticipated Results from text()
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 26 Feb 2007 17:16:33 GMT
Re:  Unanticipated Results from text()
> Loss of whitespace isn't what concerns me, it's the loss of the
> non-whitespace that has me puzzled.

it's loss of whitespace that is causing your problem though, as once you
have lost the white space the numbering of the other text nodes is
changed accordingly.

If you have

<x>
<y> abc </y>
test
</x>

and with x as the current node go

normalize-space(text())

then text() selects the node set of text child nodes, which in a
conforming system is a set of two nodes with values
"(newline)" and "(newline)test(newline)"
respectively.


normalize-space() requires a string input so (in xpath 1) silently
discards all but the first node in document order, and takes teh string
value of that node.

So in a conforming system, normalize-space gets passed "(newline)" and
returns ""

If however MSXML has thrown away the white space already then

the input is essentially this:

<x><y> abc </y>
test
</x>

so now text() just selects one text node child, with value

 "(newline)test(newline)"

and the string value of that gets passed to  normalize-space which then
returns "test".

David

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-2007 All Rights Reserved.