This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to seperate sequence?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]