You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Frédéric Tremblay <ft...@eonmediainc.com> on 2002/03/27 19:50:52 UTC
Call template at every fifth element?
Hi, i want to make a HTML table with 5 column and n rows with a XML like
this:
<root>
<test number="1">
<test number="2">
<test number="3">
<test number="4">
<test number="5">
...
<test number="100">
</root>
so i want to make a table with 5 column and n rows, at every 5 element
i want a new row. How can i do this? Can i call a template with the first
element, the sixth and so on automaticaly? I try a lot of think but the
problem
is to open and close the row with <tr> and </tr>...
Thanks a lot!
Fred
Re: Call template at every fifth element?
Posted by Guy McArthur <gu...@guymcarthur.com>.
there is an example on the xslt faq page:
http://www.dpawson.co.uk/xsl/sect2/N7450.html#d53e15
E.g. for a five column table:
<xsl:for-each select="item[position() mod 5 = 1]">
<tr>
<xsl:apply-templates
select=".|following-sibling::item[position() < 5]"/>
</tr>
<xsl:for-each>