At 2010-03-18 13:12 +0100, Robby Pelssers wrote:
I would like to sort following strings ['BSS84/A2', 'BSS84/DG', 'BSS84'],
default sorting results in:
BSS84/A2 -> BSS84/DG -> BSS84
Not with the processor I am using (Saxon).
But the customer wants them sorted like
BSS84 -> BSS84/A2 -> BSS84/DG
So would I!
What's the easiest way to accomplish this?
Do I need to write a custom comparator function or can I use some
<xsl:sort> shortcuts or is the only way to use collations?
Which processor are you using?
Below is an example ... what you want is ASCIIbetical and so the
default sort collation of Unicode is fine.
I hope this helps.
. . . . . . . . . . . Ken
t:\ftemp>type robby.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="('BSS84/A2', 'BSS84/DG', 'BSS84')">
<xsl:sort/>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
t:\ftemp>xslt2 robby.xsl robby.xsl
BSS84
BSS84/A2
BSS84/DG
t:\ftemp>
--
XSLT/XQuery training: San Carlos, California 2010-04-26/30
Principles of XSLT for XQuery Writers: San Francisco,CA 2010-05-03
XSLT/XQuery training: Ottawa, Canada 2010-05-10/14
XSLT/XQuery/UBL/Code List training: Trondheim,Norway 2010-06-02/11
Vote for your XML training: http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--