It's all in the mod of the position() function.

I know you can't increment variables, which in my mind doesn't make them
variables anymore.  But that is my rant. :)


My code for doing something like this is below, there is prolly a much
better solution with out <xsl:text disable-output-escaping="yes"> and CDATA
sections.  but it works


try a template something like this:
                <xsl:if test="(position() mod 3)=1">
                <xsl:text disable-output-escaping="yes">
                                <![CDATA[<tr>]]>
                        </xsl:text>
        </xsl:if>
                <td>
                        Put your picture here
                </td>
                <xsl:if test="(position() mod 3)=0">
                <xsl:text disable-output-escaping="yes">
                                <![CDATA[</tr>]]>
                        </xsl:text>
        </xsl:if>


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 29, 2001 9:15 AM
To: Sablotron Mailing List
Subject: [Sab] Incrementing Variable?


Hello...
I have a XML with many pictures data. i m making a XSLT to process it.
i need a table like
<table>
   <tr>
       <td>Picture 1</td>
       <td>Picture 2</td>
       <td>Picture 3</td>
   </tr>
   <tr>
       <td>Picture 4</td>
       <td>Picture 5</td>
       <td>Picture 6</td>
   </tr>
</table>

i dont know the quantity of pictures they can be 6 or 100...
but i need them to be ordered in 3 columns and the nesesary rows.
so i need to add a </tr><tr> every 3 images... i can do this with mod
function.
but i dont know how can i do to have the index of my xml:for-each
if can do this incrementing a variable but i dont know how.
Thanks in advance.
Diego S. Macadar
AldeaX.-
Argentina

Reply via email to