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

Re: Text Table with sorting

Subject: Re: Text Table with sorting
From: Ryan Sawatzky <rsawatzky@xxxxxxxxxxx>
Date: Thu, 25 Sep 2003 14:51:06 -0500
ryan sawatzky
Hi Jeni,

This is a tough problem. To be honest, I'd approach it using two
steps: one to do the sorting and the other to arrange the columns. In
other words, create an intermediate representation like:

<person>
   <maritalStatus refDate="1997-01-15">marriage</maritalStatus>
   <religion refDate="1996-12-02">Lutheran</religion>
   <maritalStatus refDate="1993-06-24">divorce</maritalStatus>
   <maritalStatus refDate="1989-04-11">marriage</maritalStatus>
   <religion refDate="1968-04-05">Roman Catholic</religion>
   <dateOfBirth>1968-04-05</dateOfBirth>
</person>

(which is simply a matter of sorting by @refDate), and then to your
desired output, using your current method of indexing into the three
node-sets of <maritalStatus>, <religion> and <dateOfBirth> elements.


I like this idea, because I would be able to use my current method of indexing to print the line for tables that get sorted and ones that don't. Coming from a C perspective I get to reuse my current funtion! Yeah :).

However, I'm rather new to XSLT and I don't know how I would generate that intermediate representation. I was under the impression that you could only have a <xsl:sort> element under a <xsl:for-each> element, but upon consulting my big XML book, I see that you can have one under an <xsl:apply-templates> element.

So my question is, where would I put the sort statement? Would I put it under my <xsl:apply-templates select="person"/> statement? And doing that would sort all the children elements of <person> according to their refDate attributes correct?

Thanks for your help,
--Ryan




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.