Subject: RE: xsl:perform-sort (in 2.0)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 5 Apr 2005 11:35:58 +0100
|
> I just noticed this new instruction (although it was in the last draft
> as well)
>
> Is there any difference bewteen
>
> <xsl:perform-sort select="$in">
> <xsl:sort select="."/>
> </xsl:perform-sort>
>
> and
>
> <xsl:for-each select="$in">
> <xsl:sort select="."/>
> <xsl:copy-of select="."/>
> </xsl:for-each>
>
> either from a definitional or efficiency point of view?
>
It's actually been there quite a while, and I think it's proving to be
perhaps the least-used new feature in the spec. It was put in as a
replacement for a sort() function which took a global sort specification as
an argument - rather like xsl:key and key() - but it doesn't seem to be
doing a very useful job.
Actually the equivalence is to:
<xsl:for-each select="$in">
<xsl:sort select="."/>
<xsl:sequence select="."/>
</xsl:for-each>
since no copying is involved.
Michael Kay
http://www.saxonica.com/
|