|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Sorting Nested Loops
Subject: Re: Sorting Nested Loops
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 09 Jul 2002 20:16:29 +0000
|
Tyler,
If you want to sort the tabs with respect to sequence attribute in
ascending,
u may try doing..
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="/leadsite/tabs/tab">
<xsl:sort select="@sequence" order="ascending" data-type="number"/>
<xsl:value-of select="@sequence"/><br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
cheers
Vasu
From: "Tyler Queen" <xmllist@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Sorting Nested Loops
Date: Tue, 09 Jul 2002 12:19:09 -0700 (PDT)
I posted this question earlier, but I did'nt include
enough info. I hope this helps. I am having trouble
getting the desired results when I try to sort by an
attribute in a nested loop. I want to sort by the
sequence attribute in ascending order. I get them back
in this order
1, 7, 8, 14, 3, 4, 9, 10, 5, 6, 11, 12, 2, 13
Any ideas?
This is the xml
<?xml version="1.0" encoding="iso-8859-1" ?>
<leadsite>
<tabs>
<tab typeid="" sequence="1" active="1">
<label>Tab 1</label>
<url>/controlcenter/applications/frog.asp?aid=12&fid=123</url>
</tab>
<tab typeid="" sequence="14" active="1">
<label>Tab 14</label>
<url>/controlcenter/applications/tyler.asp</url>
</tab>
</tabs>
</leadsite>
This is the xsl
<tabs>
<tab typeid="" sequence="1" active="1">
<label>Tab 1</label>
<url></url>
</tab>
<tab typeid="" sequence="14" active="1">
<label>Tab 14</label>
<url></url>
</tab>
<tab typeid="" sequence="7" active="1">
<label>Tab 7</label>
<url></url>
</tab>
<tab typeid="" sequence="8" active="1">
<label>Tab 8</label>
<url></url>
</tab>
<tab typeid="" sequence="10" active="1">
<label>Tab 10</label>
<url></url>
</tab>
<tab typeid="" sequence="9" active="1">
<label>Tab 9</label>
<url></url>
</tab>
<tab typeid="" sequence="3" active="">
<label>Tab 3</label>
<url></url>
</tab>
<tab typeid="" sequence="4" active="1">
<label>Tab 4</label>
<url></url>
</tab>
<tab typeid="" sequence="5" active="1">
<label>Tab 5</label>
<url>/controlcenter/applications/tyler.asp</url>
</tab>
<tab typeid="" sequence="6" active="1">
<label>Tab 6</label>
<url></url>
</tab>
<tab typeid="" sequence="12" active="1">
<label>Tab 12</label>
<url>/controlcenter/applications/tyler.asp</url>
</tab>
<tab typeid="" sequence="11" active="1">
<label>Tab 11</label>
<url></url>
</tab>
<tab typeid="" sequence="13" active="1">
<label>Tab 13</label>
<url></url>
</tab>
<tab typeid="" sequence="2" active="1">
<label>Tab 2</label>
<url></url>
</tab>
</tabs>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
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
| RSS 2.0 |
|
| Atom 0.3 |
|
|