xsl-list
[Top] [All Lists]

Re: [xsl] General rule for designing XPath expressions to return items in document order?

2014-01-09 05:14:10
On Thu, January 9, 2014 10:51 am, Costello, Roger L. wrote:
I applied this XPath expression

      //head

to this XML document

<Document>
    <head>
        <head>B</head>
        A
    </head>
</Document>

using oXygen (where SAXON is the XPath processor) and got these results:

A
B

That is, the results are in non-document order.

Your reported results don't match your XPath applied to your document, but
the order of the <head> containing 'A' (ignoring the child <head>) then
the <head> containing 'B' is document order because the <head> containing
'A' starts before the <head> containing 'B'.

If you selected text nodes (and ignored all white-space), then 'B' would
come before 'A'.

Your reported results don't match your XPath applied to your document
since the first <head> is:

<head>
        <head>B</head>
        A
     </head>

with a string value ignoring, rather than just normalising, white-space
(if that's what you were reporting) of 'BA'.

Regards,


Tony Graham                                   tgraham(_at_)mentea(_dot_)net
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL-FO and XSLT consulting, training and programming
       Chair, Print and Page Layout Community Group @ W3C



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