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
<xsl:for-each select="sort('sort-key-1', catalog/cd)">
Thanks for the comment.
Mike Kay

-----Original Message-----
From: Kevin O'Riordan []
Sent: 09 January 2002 12:39
Subject: XSL sort

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
<xsl:for-each select="catalog/cd">
      <xsl:sort select="artist"/>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
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
like this makes more intuitive sense.
<xsl:for-each select="catalog/cd"   sort="artist">
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
Kevin O'Riordan


Received on Wednesday, 9 January 2002 10:43:22 UTC