RE: Comments on XPath 2.0 specification

Michael Kay (<Michael.Kay@softwareag.com> wrote
 > Mike Schilling (mschilling@edgility.com) wrote


> There are many good reasons, I think, for not adopting the "dot product"
> semantics you suggest. One of them is simply that it's incompatible with
> XPath 1.0.


As is the current 2.0 proposal (that this is now an error).  Admittedly, 
that's safer than changing its value without issuing an error.

Still, compare

	sum(//item/quantity * //item/USPrice)

and

	sum(for $item in //item return($item/quantity*$item/USPrice))

(Assuming that's correct.  I'm presuming the bound variable does not 
become the focus of the return expression, since I can't find language 
in the spec saying it does.)

Which is simpler and eaiser to use?

By the way, I presume someone has noticed how much this looks like an 
SQL select, and suggested something akin to

		sum(select quantity*price from //item)


(Here the value of "from" *does* become the focus.)

It still has the disadvantages of keywords and complexity, but at least it's

clearly not procedural.

Received on Tuesday, 22 January 2002 23:21:09 UTC