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

Nasty XPath expressions

  • To: xml-dev@l...
  • Subject: Nasty XPath expressions
  • From: Kelvin Yeow <whyeow@c...>
  • Date: Sat, 15 Dec 2001 01:53:24 -0800 (PST)

xalan2 xpath
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



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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.