[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: display problem

Subject: Re: display problem
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Thu, 31 Jan 2002 11:22:04 +0100
rss xml 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()
&lt; 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.