W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 2002

XSL sort

From: Kevin O'Riordan <koriordan99@hotmail.com>
Date: Wed, 9 Jan 2002 07:39:12 -0500 (EST)
To: <xsl-editors@w3.org>
Message-ID: <LAW2-OE23qFJ3sl3xbY000009b0@hotmail.com>
Hi
I haven't looked in any great detail at the new spec so my apologies of these comments are irrelevant:

Consider the following snippet from an xsl file taken from the w3c schools tutorial:


<xsl:for-each select="catalog/cd">
      <xsl:sort select="artist"/>
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
      </tr>
</xsl:for-each>




Apart from the nested sort, the xsl nexted within the 'for each' block acts on each specific  'cd' element found in the xml file to be transformed.
In my view, it is unintuitive and confusing to have the 'sort'  instruction at this level when it really pertains to the whole iteration. I think a syntax
like this makes more intuitive sense.


<xsl:for-each select="catalog/cd"   sort="artist">
        <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
      </tr>
</xsl:for-each>


Regards
Kevin O'Riordan
Received on Wednesday, 9 January 2002 08:29:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:52 GMT