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

RE: Looking for a shorter mapping expression

Subject: RE: Looking for a shorter mapping expression
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 5 Dec 2004 21:40:32 -0000
different operator xsl
> Because, according to the XPath 2.0 spec:
> 
> "only the last step in a path is allowed to return a sequence 
> of atomic values."
> 
> http://www.w3.org/TR/xpath20/#id-path-expressions
> 
> Even the last E2 in a path expression should evaluate either to a
> sequence of nodes or a sequence of atomic values, but not a mixture of
> the two... I find this unreasonably restrictive and wonder why it was
> decided so.

Until the most recent draft there was no way of mapping an expression over a
sequence without using a range variable: the "for $x in $s return f($x)"
construct.

In the most recent draft the rules for "/" were relaxed to allow constructs
such as $seq/name(): in general for the expression E1/E2, E1 must return a
sequence of nodes and E2 must return a homogenous sequence, either atomic
values or nodes.

Some of us argued instead for a different operator, say !, in which E1!E2
would perform a general mapping, the equivalent of "for . in E1 return E2".
Note that this is not the same as the "/" operator in the case of nodes,
because it doesn't return the results in document order or eliminate
duplicates. However, there has been strong opposition to the introduction of
a second operator on the grounds that users wouldn't understand the
difference from "/" and that it doesn't add any new functionality over what
can be achieved with "for" expressions.

The reason for restricting the rhs of "/" to be homogenous is that this is
the only reasonable way you can overload the operator to deliver results in
document order in the case of nodes, or retaining the input order in the
case of atomic values.

There are various reasons for retaining the restriction on the lhs to
consist of nodes. One is that it's easier to get a small change through a
committee than a big change. Another is that some people cannot stomach the
idea that the value of the expression 1/2 should be 2.

Michael Kay
http://www.saxonica.com/

Current Thread

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
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.