Reply to XSL/CSS for-each results in a table

Your name:

Reply:


Posted by Martin Pöpping on 11/29/06 16:31

Hello,

I´ve a little design/coding/layout problem.

I´m getting xml data in a for-each loop with:

<xsl:for-each select="/data">
<xsl:sort select="@freq" data-type="number" order="descending" />
<xsl:value-of select="." />(<xsl:value-of select="@freq" />)<br/>
</xsl:for-each>

As you can see with the <br/>-Tag every single value is written in a new
line.

Now I want to transfer this result into a table with 3 columns.

How can I do that?

I thought to write use a variable i and working with modulo like this:

<table>
<xsl:param name="z">1</xsl:param>
<xsl:for-each select="conceptlist/concept">
<xsl:choose>
<xsl:when test="$z%3==1">
<tr>
<td>
<xsl:sort select="@rank" data-type="number" order="descending" />
<xsl:value-of select="@name" /> (<xsl:value-of select="@rank"/>);
</td>
</xsl:when>
<xsl:when test="$z%3==0">

<td>
<xsl:sort select="@rank" data-type="number" order="descending" />
<xsl:value-of select="@name" /> (<xsl:value-of select="@rank"/>);
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:sort select="@rank" data-type="number" order="descending" />
<xsl:value-of select="@name" /> (<xsl:value-of select="@rank"/>);
</td>
</xsl:otherwise>
<xsl:with-param name="z" select="$z+1"/>
</xsl:choose>
</xsl:for-each>
</table>

Of course this lines of code do not work because I cannot _not-nested_
syntax like this:

<xsl:when test="$z%3==1">
<tr>
<td>
<xsl:sort select="@rank" data-type="number" order="descending" />
<xsl:value-of select="@name" /> (<xsl:value-of select="@rank"/>);
</td>
</xsl:when>


because the start tag "<tr>" is closed by the tag "</xsl:when>" which
will result an error.

But I do not have any other idea to create a 3-column-table with using
xsl:for-each.


How do you do that?



Regards,

Martin

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация