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

Re: For expressions and / operator in XPath 2.0 (Was: Re: [x

Subject: Re: For expressions and / operator in XPath 2.0 (Was: Re: result = node1 * node2 and then get total of all the result from whole document at the end)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 2 Jan 2002 23:15:50 +0000
like operator in xpath
Hi Mike,

> It would mean, for example, that sum(XXX/@value) would not
> necessarily give the same answer as sum(XXX/(@value+0)) (where XXX
> is an arbitrary expression); though it would give the same answer
> 99% of the time, which would make the exceptions even more
> surprising.

Gah, I see. There's sort of the same kind of thing with:

  section[keyword = $keyword]


  section[starts-with(keyword, $keyword)]


  section/keyword[starts-with(., $keyword)]

which we have to answer questions about all the time.

> After months of agonising on this one, we just decided to keep
> things simple: "/" eliminates duplicates and returns results in
> canonical order, "for" retains duplicates and retains the ordering
> of the operand. I was sad to lose "sum(//rate/(@value * @quantity))"
> but I'd rather make it an error than have it return results that
> were difficult to explain to people.

It's a shame. I do dislike all the keywords that seem to have infected
XPath, which make it seem more like a programming language in its own
right than a simple expression language :( I don't suppose we could
get rid of this one and use some kind of symbol or operator instead,

  //rate -> (@value * @quantity)



Jeni Tennison

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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-2013 All Rights Reserved.