[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] mismatched tags with xsl:if
Subject: RE: [xsl] mismatched tags with xsl:if From: Xavier Defrang <xavier@xxxxxxxxxxxx> Date: Tue, 13 Mar 2001 09:24:15 +0100 (CET) |
First of all I'd like to thank you all for the feedback. I'll explain a bit further what I'm trying to do. I actually want to render a 3 collumns XHTML table with a list of items. I want them to appear as follow : item1 item2 item3 item4 item5 item6 item7 ... To do so, I have a for-each loop over the items that output the <td>item</td>. Now I have to set some condition to generate the <tr> and </tr> every three items. These tags are the one I planned to put within under a condition depending on the position() of the item modulus 3 (the number of columns). Here's an excerpt of my _INVALID_ stylesheet : [snip] <table width="100%"> <xsl:for-each select="pkg-list/pkg"> <xsl:if test="position() % 3 == 1"> <tr> <!-- Start a new rowi (ERROR!) --> </xsl:if> <td> <xsl:value-of select="."/> </td> <xsl:if test="position() % 3 == 0"> </tr> <!-- End row (ERROR!) --> </xsl:if> </xsl:for-each> </table> [snip] I'm afraid that with such a logic, none of the solution you proposed will work because I have to enclose 3 items within a single tag pair... Maybe do I have to re-engineer the way I iterate over the pkg sequence? I'm not experienced enough with XSLT to figure out which way is the best to get through it... Regards Xavier Defrang Perceval R&D Team xavier@xxxxxxxxxxxx ------------------------------------------------- Perceval Technologies SA/NV Tel: +32-2-6409194 Rue Tenbosch, 9 Fax: +32-2-6403154 B-1000 Brussels http://www.perceval.net BELGIUM info@xxxxxxxxxxxx ------------------------------------------------- On Mon, 12 Mar 2001, Edmund Mitchell wrote: > Hello > > -----Original Message----- > From: Xavier Defrang [mailto:xavier@xxxxxxxxxxxx] > > <xsl:if test="..."> > <tag> <!-- opening tag --> > </xsl:if> > ... > <xsl:if test="..."> > </tag> <!-- corresponding closing tag --> > </xsl:if> > > I know I read a few times ago how to handle this > case > > This is not allowed. Can you post some details about what you are trying to > do? > > Edmund > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] mismatched tags with xsl:, Edmund Mitchell | Thread | RE: [xsl] mismatched tags with xsl:, Michael Kay |
Re: [xsl] calculating the length ??, Dimitre Novatchev | Date | [xsl] Move elements to an upper lev, Borca, Olivier |
Month |