xsl-list
[Top] [All Lists]

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

2006-07-14 12:49:30

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>