RE: [xsl] Looking for a shorter mapping expression

Subject: RE: [xsl] Looking for a shorter mapping expression
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 6 Dec 2004 09:14:04 -0000
> It seemed to me that both constraints would be in force for any LHS
> operand, because it happens that at the same time this LHS operand is
> also the RHS operand of the preceding from left  "/".

I think it's a mistake to think of a path expression as a sequence of steps
separated by "/". (It's therefore also a mistake for the XPath spec to speak
of "the last step in a path expression".) It's better to think of "/" as a
binary higher-order operator. So A/B/C/D is simply ((A/B)/C)/D. The
left-hand operand of "/" is not necessarily sorted and deduplicated; it will
only be sorted and deduplicated if it is itself one of the kinds of
expression that returns its results sorted and deduplicated.

> 
> Because every E1 is also some E2 for another "/", then the above
> applies fully for this E1, too -- in fact it has been first evaluated
> as an E2 and only then it serves as an E1 for the next "/".

It's not true that every E1 is the right-hand operand of a "/" operator. For
example, E1 might be the expression (author, title). Or it might be the
expression reverse(ancestor::*).

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

Current Thread