xsl-list
[Top] [All Lists]

Re: [xsl] Xpath3 method for concisely getting position of ranging variable in FOR expression?

2014-03-14 11:31:08
Ah, thanks for that.


On Fri, Mar 14, 2014 at 5:16 PM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:
In many cases "for" expressions can now be written with the "!" operator, and 
in this case you can use position().

For example

for $i in 1 to count($seq)) return $i * seq[$i]

can now be written as

$seq ! (. * position())

Michael Kay
Saxonica

On 14 Mar 2014, at 15:53, David Rudel <fwqhgads(_at_)gmail(_dot_)com> wrote:

In Xpath2, there was no super-concise method of extracting the
position of a ranging variable in a for expression.

For example, in the expression "for $i in $seq return [expression]",
you could not use $i/position() to give you the position of $i.

Instead you had to rewrite as "for $n in 1 to count($seq)"... and then
use $n or $seq[$n] as needed.

I'm writing to ask whether there is any new method in Xpath3 that
provides a more concise method of referencing the position of a bound
range variable.

-David

--

"A false conclusion, once arrived at and widely accepted is not
dislodged easily, and the less it is understood, the more tenaciously
it is held." - Cantor's Law of Preservation of Ignorance.

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



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




-- 

"A false conclusion, once arrived at and widely accepted is not
dislodged easily, and the less it is understood, the more tenaciously
it is held." - Cantor's Law of Preservation of Ignorance.

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