|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: display problem
Hello Shahid,
you have to access every third node, to create a new <tr>. Then you have to
access this and the next 2 <count>s to create the <td>s.
<xsl:template match="test">
<table>
<xsl:apply-templates select="count[position() mod 3 = 1]"
mode="tablerow"/>
</table>
</xsl:template>
<xsl:template match="count" mode="tablerow">
<tr>
<xsl:apply-templates select=". | following-sibling::count[position()
< 3]"/>
</tr>
</xsl:template>
<xsl:template match="count">
<td><xsl:value-of select="name"/></td>
</xsl:template>
Of course, you can parameterize this stylesheet. Add a toplevel-param with
the count of cols you want to have and replace the both '3' by the name of
the param.
Regards,
Joerg
----- Original Message -----
From: "Shahid Mahmood" <shahid@xxxxxxxxxxx>
To: <xsL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, January 31, 2002 7:48 AM
Subject: display problem
> Hi All
>
> I am a newcomer in XSL. I have a problem with displaying xml. I want an
> output of xml such as
>
> <TABLE>
> <TR>
> <TD>1</TD>
> <TD>2</TD>
> <TD>3</TD>
> </TR>
> <TR>
> <TD>4</TD>
> <TD>5</TD>
> <TD>6</TD>
> </TR>
> <TR>
> <TD>7</TD>
> <TD>8</TD>
>
> </TR>
> </TABLE>
>
>
> here is the xml file
> <test>
> <count>
> <name>1</name>
> </count>
> <count>
> <name>2</name>
> </count>
> <count>
> <name>3</name>
> </count>
> <count>
> <name>4</name>
> </count>
> <count>
> <name>5</name>
> </count>
> <count>
> <name>6</name>
> </count>
> <count>
> <name>7</name>
> </count >
> <count>
> <name>8</name>
> </count>
>
> </test>
> Thanks.
>
> Shahid Mahmood
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








