[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: sorting & styling
Subject: RE: sorting & styling From: Kay Michael <Michael.Kay@xxxxxxx> Date: Wed, 15 Sep 1999 13:59:51 +0100 |
> > Sort, once, a list of elements and generate a table with the > sorted list, with the number of elements per row given in the stylesheet: > This falls into the general category of "grouping problems", they can be done in XSLT but it isn't easy. You need something like <xsl:template name="do-the-rest"> <xsl:param name="start"/> <xsl:param name="count"/> <tr> <xsl:for-each select="item[position()>=$start and position()<$start+$count"> <td> <xsl:value-of select="."/> </td> </xsl:for-each> </tr> <xsl:if test="$start + $count - 1 < last()"> <xsl:call-template name="do-the-rest"> <xsl:with-param name="start" select="$start + $count"/> <xsl:with-param name="count" select="$count"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template match="data"> <xsl:call-template name="do-the-rest"> <xsl:with-param name="start" select="1"/> <xsl:with-param name="count" select="2"/> </xsl:call-template> </xsl:template> Mike Kay > For example: > > <data> > <item>b</item> > <item>a</item> > <item>d</item> > <item>c</item> > </data> > > gives, with 2 elements per row: > > <table> > <tr> <td>a</td> <td>b</td> </tr> > <tr> <td>c</td> <td>d</td> </tr> > </table> > > > Olivier > > > --- > Olivier Corby, Acacia project, INRIA Sophia Antipolis > email : Olivier.Corby@xxxxxxxxxxxxxxx tel : +33 4 92 38 78 71 > > > > 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: sorting & styling, Miloslav Nic | Thread | Re: sorting & styling, Miloslav Nic |
Re: What will be the future improve, Sebastian Rahtz | Date | Re: What will be the future improve, Tangi Vass |
Month |
Keywords