RE: XSL sort

Thanks for the comment. I agree that it's a little inelegant. Unfortunately
it isn't really feasible to use an attribute because there can be multiple
sort keys. Nor is it really feasible to change the current syntax, which is
now well-established, even if we could come up with something that's
obviously better.
 
You do have the option with XSLT 2.0 to write a top-level sort key
specification, using <xsl:sort-key>, and then to reference it in the select
expression:
 
<xsl:for-each select="sort('sort-key-1', catalog/cd)">
   ...
</xsl:for-each>
 
Thanks for the comment.
 
Mike Kay

-----Original Message-----
From: Kevin O'Riordan [mailto:koriordan99@hotmail.com]
Sent: 09 January 2002 12:39
To: xsl-editors@w3.org
Subject: XSL sort


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 10:43:22 UTC