Re: [xsl] Cannot enter data into Dynamic Table cells

Subject: Re: [xsl] Cannot enter data into Dynamic Table cells
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 1 Jul 2004 13:56:10 +0100
  the problem seems to be the line :

  <xsl:for-each select="current()[position()]/following::*[position() &lt; 
   5]">


a predicate [] with a numeric value is shorthand for
[position()=that value]
so foo[2] is foo[position()=2] etc

you have
[position()]
which is[position()=position()]
which is [true()] so is no filter at all.
so your first step in the Xpath is just equivalent to
current()
so it could be ommitted as relative Xpath's are always interpreted
relative to the current node.
so it is equivalent to

following::*[position() &lt; 5]
which is legal, but not what you want, it selects the next 4 eleemnt
nodes after the current node _in the source document_

You want (I think) the next four items in your $unique-ref set, which
you can't do directly using any axis.

The five items you want are
<xsl:for-each select="$unique-ref[position() mod 5 = 1]">
<xsl:variable name="n" select="position() - 1"/>
...
something with
$unique-ref[$n * 5 +1]
$unique-ref[$n * 5 +2]
$unique-ref[$n * 5 +3]
$unique-ref[$n * 5 +4]
$unique-ref[$n * 5 +5]

so on your first iteration, $n will be 0 and you'll get
$unique-ref[1] .. $unique-ref[5]
on your second, $n will be 1 and you'l get
$unique-ref[6] .. $unique-ref[10]

David


-- 
The LaTeX Companion
  http://www.awprofessional.com/bookstore/product.asp?isbn=0201362996
  http://www.amazon.co.uk/exec/obidos/tg/detail/-/0201362996/202-7257897-0619804


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread