[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: sorting product descriptions

Subject: Re: sorting product descriptions
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Mon, 07 May 2001 16:47:30 +0100
sorting product
Tobias Reif wrote:
> 
> Hi Francis;
> 
> > You have a solution at
> > http://redrice.com/xml/sortfunction.zip
> 
> Awesome! It works *very* well so far.
> 
There is now a new version at
http://redrice.com/xml/sortfunction_0_1.zip which implements a
mix-and-match architecture.

You can now import and call either the simplesort or mergesort template
with exactly the same parameters including one which specifies which of
your project-specific compare templates you want used.

Both sort templates return their result in the same way, as an ordered
list of node-ids, eg

	"[1:cr423][2:cd342]..."

which can be de-referenced very conveniently within for-each loops or
even XPath expressions.

The demo can be run from the command line:

---
C:\test>saxon sort.xml sortcall.xslt
<?xml version="1.0" encoding="UTF-8"?>
<product id="a_a_00_01">                2       </product>
<product id="a_a_00_03">                1       </product>
<product id="a_a_00_05">                4       </product>
<product id="a_a_00_9">                 w       </product>
<product id="a_a_00_9">                 x       </product>
<product id="a_a_00_b">                 y       </product>
<product id="a_a_00_b">                 z       </product>
<product id="a_b_00_02">                3       </product>
<product id="a_a_30_50">                5       </product>
<product id="a_a_60_20">                6       </product>
<product id="a_a_30_20">                7       </product>
<product id="a_a_100_30">               8       </product>
C:\test>
---

To switch sortcall.xslt from using mergesort to simplesort, change line
19 from

			<xsl:call-template name="mergesort">

to 

			<xsl:call-template name="simplesort">

Very much in beta at the moment but I will put more work in if there is
demand.

Francis.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.