Subject: [xsl] RE: Sort on multiple key From: Tony Nassar <tnassar@xxxxxxxxxxxxxxxx> Date: Sat, 24 May 2008 10:36:52 -0700 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Sort on multiple key, Hesselberth, Jan | Thread | [xsl] glossary sorting/indexing que, Trevor Nicholls |
[xsl] Output sorted XHTML table for, Steven Davies | Date | Re: [xsl] fo:instream-foreign-objec, J.Pietschmann |
Month |