Re: [xsl] A beef with XSLT Sometimes too complicated

Subject: Re: [xsl] A beef with XSLT Sometimes too complicated
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 14 Jul 2006 20:49:02 +0100
> for $i in (for $j in $someSeq return some($j)) return ...?
sorry you can nest as many for as you like but it can't be done (I
claim)

> But I'm really not even sure I follow what you math-heads are getting 

in xquery you can go
let $s := (1,2,3)
return
count($s)

and get 3

in xslt you can go

<xsl:variable name="s" select="(1,2,3)"/>
<xsl:sequence select="count($s)"/>

and get 3 as well.

But in XPath You don't have all of XQuery's FLWOR
(For-Let-Where-OrderBy-Return) expression, in particular you don't have
the Let clause so you can't go

let $s := (1,2,3)


if you have an xquery that binds a single item to a variable 
let $i := count(foo)
return .....$s
then you can do the same binding in XPath by replacing the let by a for
for $s in count(foo)
return .... $s

but if the let clause is binding the variable to a sequence of zero or
more than one items there is no way to bind that sequence to a variable
in Xpath. All the XPath binding expressions, namely for, some, every
iterate through a sequence and bind the variable to (at eaxh iteration)
a single item. This is often annoying (if you get annoyed by such
things).

David

Current Thread