Re: [xsl] how to seperate sequence?

Subject: Re: [xsl] how to seperate sequence?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 12 Aug 2002 10:35:05 +0100
Hi Thomas,

> How can I use e.g. a 'xsl:if test = "position() mod 2 == 0"'
> expression, or does anyone have a better way to do it?

That's almost it. You need to create a row for every odd para in your
content (the ones whose position() mod 2 is 1):

  <xsl:for-each select="para[position() mod 2 = 1]">
    <tr>
      ...
    </tr>
  </xsl:for-each>

Inside the row, the first cell holds the odd para element that you're
looking at, and the second cell holds that para element's immediately
following sibling:

  <xsl:for-each select="para[position() mod 2 = 1]">
    <tr>
      <td><xsl:value-of select="." /></td>
      <td><xsl:value-of select="following-sibling::para[1]" /></td>
    </tr>
  </xsl:for-each>

Cheers,

Jeni

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


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


Current Thread