[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Proposal: Copying with Sorting

Subject: RE: Proposal: Copying with Sorting
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Sun, 5 Jan 2003 18:41:26 -0000
RE:  Proposal: Copying with Sorting
XSLT 2.0 allows you to create a sorted sequence of nodes using the
sort() function, with named sort keys:

<xsl:sort-key name="sk1">
  <xsl:sort select="exp2"/>
</xsl:sort-key>

<xsl:copy-of select="sort('sk1', exp)"/>

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Dimitre Novatchev
> Sent: 05 January 2003 09:01
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Proposal: Copying with Sorting
> 
> 
> 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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.