I would like to propose a simplification of the most widely used case
of sorting, when a the members of a node-set are simply copied in a
different order.
The proposal is to allow xsl:sort to be a child of xsl:copy-of.
Thus instead of writing [1]:
<xsl:for-each select="expression">
<xsl:sort select="expression2"/>
<xsl:copy-of select="."/>
</xsl:for-each>
one would simply write [2]:
<xsl:copy-of select="expression">
<xsl:sort select="expression2"/>
</xsl:copy-of>
What are the advantages of having [2]?
1. The new instruction is more compact and simpler.
2. It reflects the principle that it should be possible to do simple
things in a simple way.
3. Shorter, simpler, more readable and maintainable xslt code.
4. Probably allows a more efficient implementation.
5. The programmer will not have to worry whether to use (gasp!) an
xsl:for-each or an xsl:apply-templates with or without mode.
6. Eliminates the vast number of programming errors, when the
programmer simply forgets to specify <xsl:copy-of select="."/> in
[1]
A further simplification will be achieved if a "sort" attibute is
allowed in case of sorting on a single key only.
Then we could write [3]:
<xsl:copy-of select="expression" sort="expression2" />
I would appreciate receiving any comments on this proposal. Would you
like to have this feature proposed for inclusion in XSLT 2.0?
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list