[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Proposal: Copying with Sorting
Subject: RE: [xsl] Proposal: Copying with Sorting From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Sun, 5 Jan 2003 18:41:26 -0000 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Proposal: Copying with Sortin, Dimitre Novatchev | Thread | Re: [xsl] Proposal: Copying with So, Dimitre Novatchev |
RE: [xsl] [OT] charset (was: how to, Julian Reschke | Date | RE: [xsl] key grouping with non-exi, Michael Kay |
Month |
Keywords