[xep-support] xsl:sort in apply-templates

G. Ken Holman gkholman at CraneSoftwrights.com
Fri Feb 25 06:33:30 PST 2005


XSLT and XPath questions would be better posted to the following list:

   http://www.mulberrytech.com/xsl/xsl-list

There are a number of subscribers who would enthusiastically respond to 
such questions.

There is also an *excellent* FAQ at:

   http://www.dpawson.co.uk

At 2005-02-25 05:40 -0800, Martin Holmes wrote:
>For various (complicated) reasons, I wanted to use <xsl:sort> within 
><xsl:apply-templates>, rather than inside an <xsl:for-each>

It worries me that the reasons are complicated since there are simple bases 
upon which one makes the choice, but that isn't the nature of the question.

>But my main problem is that it seems to be sorting all the authors first, 
>then all the editors; is there a way to have it combine the two keys (so 
>that if there's an editor, it'll use that; otherwise, it'll use the first 
>author)?

The following will sort first by editor child of bibleStruct, and then 
where equal (including where absent), sort those of equal editor values by 
author child of biblStruct.

      <xsl:apply-templates select="biblStruct">
         <xsl:sort select="editor"/>
         <xsl:sort select="author"/>
      </xsl:apply-templates>

One can specify any number of sort keys in the above fashion ... there is 
no limit.

I hope this helps.

.................... Ken


--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/f/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



More information about the Xep-support mailing list