Re: Arbitrary sorting
Matt, > Is it possible to do arbitrary sorting after alphabetical sorting, >in XSLT? It's certainly possible to have several sorts, and there aren't any limitations on the types of sorts that you can have following other sorts. Here is a solution given your example (though perhaps it's not demonstrating the abitrariness that you're after - perhaps you can provide another example to show the breadth of problems you're talking about). First, sort on the first letter in the string: <xsl:sort select="substring-before(., ' ')" /> Then sort so that any string containing 'v' is before those that do not: with a data-type of 'number', booleans should be translated automatically to 1 if true and 0 if false. It looks as though SAXON 5.4 isn't doing this, so I've included an explicit call to number() which you may be able to take out with your processor: <xsl:sort select="number(contains(., 'v'))" data-type="number" order="descending" /> Finally, sort alphabetically. <xsl:sort select="." /> I hope this helps, Jeni Dr Jeni Tennison Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@xxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format