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

Re: sorting & styling

Subject: Re: sorting & styling
From: Miloslav Nic <nicmila@xxxxxxxx>
Date: Wed, 15 Sep 1999 15:55:59 +0200
xsl 2 items per row
This approach fails if you need sorting as was requested in this case.

Kay Michael wrote:
> 
> >
> > 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()&gt;=$start and
> position()&lt;$start+$count">
>     <td>
>     <xsl:value-of select="."/>
>     </td>
>   </xsl:for-each>
>   </tr>
>   <xsl:if test="$start + $count - 1 &lt; 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

-- 
***************************************************************
Dr. Miloslav Nic                        e-mail: nicmila@xxxxxxxx
Department of Organic Chemistry         TEL: +420 2 2435 5012  
ICT Prague (VSCHT Praha)                     +420 2 2435 4118
    				        FAX: +420 2 2435 4288  
****************************************************************


 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.