Subject: Re: [xsl] Sorting Nested Loops From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Tue, 09 Jul 2002 22:32:44 +0200 |
<xsl:varaible name="sorted-tabs-rtf"> <xsl:for-each select="tab"> <xsl:sort select="@sequence" data-type="number"/> <xsl:copy-of select="."/> </xsl:for-each> </xsl:variable>
I appologize for all the spam but I included the wrong code in the last mailing. Sorry I'm having a off day. Last try.
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></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> </leadsite>
This is the xsl
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="tabs" mode="tabs" match="leadsite/tabs"> <xsl:for-each select="tab[position() mod 4 = 1]"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <xsl:for-each select=". | following-sibling::tab[position() < 4]"> <xsl:sort select="@sequence" data-type="number" /> <xsl:call-template name="tabcells" /> </xsl:for-each> </tr> <![CDATA[</tr>]]> </table> </xsl:for-each> </xsl:template>
<xsl:template name="tabcells"> <td valign="Top" align="Left" width="8" class="tabs" background="images/Agnt_J_Tabrig_Bg.Gif"> <img height="15" src="images/Agnt_J_Tabrig.Gif" width="8" /> </td> <td valign="Center" align="Middle" class="tabs" nowrap="yes"> <xsl:variable name="url" select="url/." /> <a href="{$url}"> <xsl:value-of select="label/." /> </a> </td> <td valign="Top" align="Right" width="8" class="tabs" background="images/Agnt_J_Tablef.Gif"> <img height="15" src="images/Agnt_J_Tablef.Gif" width="8" /> </td> <td width="1"> <img height="1" src="Dot.Gif" width="1" /> </td> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Sorting Nested Loops, Tyler Queen | Thread | RE: [xsl] Sorting Nested Loops, Michael Kay |
Re: [xsl] Reverse lookup table, J.Pietschmann | Date | RE: [xsl] How I can include javscri, Vasu Chakkera |
Month |