RE: Alternative StepExpr evaluation policy

> 
> >You need to take into account that E2 is evaluated once for each node
> in E1. In principle, some evaluations >can return a number 
> and others return a node, for example:
> >E1/(if (position()=1) then 42 else *)
> >So the detailed rules are likely to be a bit complicated. 
> 
> Ok, granted, my suggestions do come from my perspective as a 
> purist in that I don't like the idea of branching 
> instructions in what I prefer to think of as a single line 
> language. That is, im assuming the feature set of Xpath that 
> is most commonly used in XSLT and simillar applications.

You missed the point. E1/E2 is a higher-order expression, in that E2 is
evaluated multiple times: it isn't a standard operator in which the two
operands are evaluated independently of each other and the result is a
function of the values of both operands. My example with a conditional was
merely a way of trying to get this point across to you by example.
> 
> By way of tangenting, if you are going to use branching 
> instructions in a single line Xpath statement why not 
> considder using the trinary conditional expression notation 
> used in languages like C++
> 
> i.e.
> 
> condition ? true-val : false-val 
> 
Clearly ":" is not available for use as an operator, for obvious reasons.

Michael Kay

Received on Wednesday, 17 September 2003 09:49:04 UTC