Re: [xsl] math get maximum and subtract 1

Subject: Re: [xsl] math get maximum and subtract 1
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 31 Jul 2002 15:57:55 +0100
Hello Sascha,

> The loop around the rows is still correct , isnt it? Well at least it
> creates the right number of rows.
>
> <xsl:for-each select="DESCRIPTION_ITEM[@col = 0]">
>     <fo:table-row>

Yes.

> But this seems to need a correction
>
>      <xsl:for-each select="../DESCRIPTION_ITEM [(position() - 1) mod $nrows
> = current()/@row]">
>
> I know, you tried to explain that to me and i understood what you
> described, but i don't get how to change it to work with the new
> input

In the new input, the DESCRIPTION_ITEM elements are ordered such that
all the cells for a particular row are clustered together. The first
of each cluster is the one whose col attribute has the value 0. The
rest of the cells in the row are the next N DESCRIPTION_ITEMs, where N
is the number of columns minus 1. One way you could select them is:

  . | following-sibling::DESCRIPTION_ITEM[position() &lt; $ncols]

Another way you could select them would be:

  ../DESCRIPTION_ITEM[@row = current()/@row]

The latter is probably better simply because if they change the order
on you again it will still work. On the other hand, the former
involves less node visits, so will probably be faster with large
tables.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread