W3C home > Mailing lists > Public > xsl-editors@w3.org > October to December 2000

Re: XSLT Feature Request: template for xsl:sort and xsl:key

From: James Clark <jjc@jclark.com>
Date: Fri, 20 Oct 2000 10:33:18 +0700
Message-ID: <39EFBCFE.BB542A09@jclark.com>
To: "G. Ken Holman" <gkholman@cranesoftwrights.com>
CC: XSL Editors <xsl-editors@w3.org>
Wouldn't a conditional expression be an easier way to achieve this?

"G. Ken Holman" wrote:
> Hi folks!
> I would like to be able to specify an evaluation template for xsl:sort so
> that I can use <xsl:choose> to conditionally specify the value by which I
> would like a node sorted.  Since there is no conditional construct in
> XPath, I am unable to influence the sorted position using a conditional
> expression.
> This has come up in writing a stylesheet for a topic map where an href
> attribute value may be either an internal reference to a topic or an
> external reference to a fragment: if I determine it is an internal
> reference (the substring before the '#' is empty), then I want the sort
> value to be obtained de-referenced from the topic, otherwise I want the
> sort value to be the href itself.
> I could do this along the lines of:
>    <xsl:sort order="descending">
>      <xsl:choose>
>        <xsl:when test="....
>        </xsl:when>
>        <xsl:otherwise>
>        </xsl:otherwise>
>      </xsl:choose>
>    </xsl:sort>
> In the same way I could use conditionals for the use= expression of
> <xsl:key> if the absence of the use= attribute implied the calculation of
> the template.
> Thanks!
> ............. Ken
> --
> G. Ken Holman                    mailto:gkholman@CraneSoftwrights.com
> Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/m/
> Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
> Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
> Book: Practical Transformation Using XSLT and XPath ISBN1-894049-05-5
> Article:          What is XSLT? http://www.xml.com/pub/2000/08/holman
> Next public instructor-led training:     2000-10-03/05,2000-10-09/10,
> -        2000-10-19,2000-11-06/07,2000-11-12,2000-12-03/04,2001-01-27
Received on Thursday, 19 October 2000 23:47:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:51 GMT