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

RE: Sort on multiple key

Subject: RE: Sort on multiple key
From: Tony Nassar <tnassar@xxxxxxxxxxxxxxxx>
Date: Sat, 24 May 2008 10:36:52 -0700
 RE: Sort on multiple key
Jan, I believe that preceding:: applies to document order, not sort order, so
this isn't going to work. If you need to group things by keys, and you're
stuck w/ XSLT 1.0, look up Jeni Tennison's helpful page on Muenchian
groupings.

-----Original Message-----
From: Hesselberth, Jan [mailto:Jan.Hesselberth@xxxxxxxxxxxxxxxxxx]
Sent: Tuesday, May 20, 2008 6:15 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Sort on multiple key

I have the xml below which needs to be sorted into key1 key2 order.
I can sort it in key1 order ok but can't get the key2 order. I tried
this but it doesn't work.
I then need to be able to process the sorted xml by element.
Can you tell me where I'm going wrong please.
Regards
        Jan Hesselberth

<xsl:for-each select="SummaryNo/element/key1">
        <xsl:sort select="." order="ascending" data-type="text"/>
        <xsl:for-each select="ancestor::SummaryNo/key2">
                <xsl:sort select="." order="ascending"
data-type="text"/>
                <xsl:for-each select="preceding::element">




<SummaryNo id="123456789">
        <key2>12345K00348</key2>
        <customerName>Investments Limited</customerName>
        <element id="4">
                <key1>2008-04-16</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
        <element id="5">
                <key1>2008-04-16</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
        <element id="6">
                <key1>2008-04-18</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
</SummaryNo>
<SummaryNo id="234567890">
        <key2>56789D00172</key2>
        <customerName>Freds Developments Limited</customerName>
        <element id="4">
                <key1>2008-04-17</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
        <element id="5">
                <key1>2008-04-16</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
</SummaryNo>
<SummaryNo id="145678999">
        <key2>44551J00106</key2>
        <customerName>Housing Trust Limited</customerName>
        <element id="1">
                <key1>2008-04-16</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
        <element id="2">
                <key1>2008-04-15</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
        <element id="3">
                <key1>2008-04-17</key1>
                <rolloverResult>
                        <errorDescription>calculateInterestCharge
failed</errorDescription>
                </rolloverResult>
        </element>
</SummaryNo>

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.