xsl-list
[Top] [All Lists]

RE: [xsl] Can grouping here the solution ?

2011-11-22 09:53:43
Wow.
I would have thought that "text()" would return the text, not a sequence of 
nodes.
That's really counter intuitive.
Rob


-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Sent: Tuesday, November 22, 2011 5:22 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: Robby Pelssers
Subject: Re: [xsl] Can grouping here the solution ?

On 21/11/2011 18:10, Robby Pelssers wrote:
Ok Ken, thx for the advice.  I actually never used to do so but at
some point in time I figured it would express more clearly the
intent. I guess I should just always assume this by default to safe
on typing.




actually using text() makes your code more fragile. If the input has any 
comments for example:

<page>page <!-- was 2 now changed-->1</page>

page has string value "page 1" so will work as expected if selected with 
an xpath of page but page/text() selects a sequence of two text nodes 
with values "page " and "1" which will either do the wrong thing, or 
generate an error, depending on how its used.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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


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