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

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

From: G. Ken Holman <gkholman@cranesoftwrights.com>
Date: Tue, 17 Oct 2000 14:52:56 +0100
Message-Id: <4.2.0.58.20001017081426.00b19d70@pop1.attglobal.net>
To: XSL Editors <xsl-editors@w3.org>
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 Wednesday, 18 October 2000 06:20:40 GMT

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