OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   [xml-dev] Nasty XPath expressions

[ Lists Home | Date Index | Thread Index ]

Bob wrote:
>XPath says that nodes should be returned in 'document order', which
>becomes a non-trivial in the case of some expressions involving
>the union operator.  One developer has a solution, but it is of
>O(tree-size) complexity.  Do that against a 30mb document, and
>suddenly XPath isn't nearly as attractive.

Hi Bob,
If 'document-order' is required, 

   $foo/bar | $cheese/melty

certainly means more work. To the best of my knowledge, Xalan2 
for Java seems to follow this 'requirement' even for expressions 
involving the union operator. In the case of '$foo/bar | $cheese/melty' 
does the order of the returned node-set matters to the user? I can
understand if a predicate is used  (example from the spec):

preceding::foo[1] != (preceding::foo)[1]

---------------------------------
Evan wrote:
>Actually, XPath nowhere says that nodes must be returned in 
> document order. Node-sets are sets; they have no order.

Although, it is not stated explicitly that nodes must be returned in 
document order, if a predicate is used in a location step, the 
ordering becomes relevant. You know, it would be more helpful if this
issue is described under section 3.3 Node-sets.

---------------------------------
Ramin wrote:
> '//' just about made me want to hurl
> every time I thought about how much work it generated under the hood.
> Then I would remember how useful it was to end-users and calm down (:-)

It is convenient and it invites abuse. I have had a brief
moment with XPath through XSLT. I often wondered
how other users take advantage of XPath's expressiveness
esp. with other axes such as 'ancestor', 'preceding' or 'following'.

---------------------------------
Mike Kay wrote:
> ... <xsl:if test="//a=//b">

This is a nasty XPath expression. It is a valid expression but all 
too convenient for the user. The developers have no choice but to tackle
it head on while the users will be delighted (esp. lazy power users).


---------------------------------
I didn't expect such a huge response to the subject, else, I would have
replied earlier. xml-dev rocks! 

Kelvin






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS