|
Subject: Re: [xsl] Proposal: Copying with Sorting From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Sun, 12 Jan 2003 10:14:15 -0800 (PST) |
> <xsl:copy-of select="sort('sk1', exp)"/>
I hope that I'm wrong, but it seems to me that the above will create a
sorted node-set (sort()) and then copy it once again (xsl:copy-of).
This shows that
<xsl:copy-of select="sort('sk1', exp)"/>
and the proposed:
<xsl:copy-of select="expression" sort="expression2" />
have a considerably different observable behaviour, the latter being
more efficient without needing additional optimisations. It also does
not have the restrictions following from the global scope of a sort
key.
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Michael Kay" <michael.h.kay@xxxxxxxxxxxx> wrote in message
news:001b01c2b4ea$0db30c20$6601a8c0@xxxxxxxxxx
> 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
>
__________________________________________________
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Proposal: Copying with So, Dimitre Novatchev | Thread | [xsl] Pipe extention in xalan, Andrey Solonchuk |
| Re: [xsl] Date Formating, Perry Molendijk | Date | [xsl] tree fragments in variable?!, Jan Mendling |
| Month |