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]

displaying results in 2 columns


ok folks, got a situation here...

What I want to do is displaying my results in a table which has two columns

that means, in html:

<table>

  <tr>

   <td>result 1</td>

   <td>result 2</td>

  </tr>

  <tr>

    <td>result 3</td>

    <td>result 4</td>

  </tr>

  ...

</table>

my XML file looks like this:

<thinglist>

  <thing value="result 1"/>

  <thing value="result 2"/>

  <thing value="result 3"/>

  <thing value="result 4"/>

   ...

</thinglist>

my XSL file should be something like this:

<table>

  <tr>

  <xsl:for-each select="thinglist/thing">

   <td><xsl:value-of select="@value"/></td>

   <xsl:if test="position() mod 2 = 1">

      </tr><tr>

   </xsl>

  </xsl:for-each>

  </tr>

</table>

but of course this is impossible because of the </tr><tr> couple of tags in the xsl:if statement.

I couldn't find a solution for this.

Anybody got an idea ?

PS: please don't answer that I have to change my XML file like so:

<thinglist>

  <thingline>

    <thing value="result1"/>

    <thing value="result2"/>

  </thingline>

  <thingline>

     ...

</thinglist>

cause I don't think it's the purpose of XML to solve this kind of problems.

Thank's in advance.


 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]