This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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)


Mike wrote:
> In XPath 2.0 the answer is
>
>    sum(for $r in //rate return $r/@value * $r/@quantity)

I feel sure that this is one of the more contentious aspects of XPath
2.0, but here goes...

Why is it that the General Steps have to return nodes? If they didn't,
you could do something like:

  sum( //rate/(@value * @quantity) )

I thought that the answer might be to do with the old set vs. sequence
thing, and the fact that for backwards compatibility, the / operator
has to union and sort the nodes.

However, I can't work out why you can't just say that the / operator
performs a union on node identity and a sort on document order; simple
typed values have neither node identity nor document order, so
sequences of simple typed values are left as they are.

Can someone enlighten me?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]