View Single Post
  #3 (permalink)  
Old June 5th, 2006, 12:50 AM
omrieliav omrieliav is offline
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry. I put extra "col" in my XML example. It should be like that:

<table>
    <col text="My Col 1" index="2" />
    <col text="My Col 2" index="3" />
    <col text="My Col 3" index="1" />
    <tr>
        <td>My Cell 1</td>
        <td>My Cell 2</td>
        <td>My Cell 3</td>
    </tr>
    <tr>
        <td>My Cell 10</td>
        <td>My Cell 20</td>
        <td>My Cell 30</td>
    </tr>
    <tr>
        <td>My Cell 100</td>
        <td>My Cell 200</td>
        <td>My Cell 300</td>
    </tr>
</table>


The result should be the following HTML:

<table>
    <tr>
        <td>My Cell 3</td>
        <td>My Cell 1</td>
        <td>My Cell 2</td>
    </tr>
    <tr>
        <td>My Cell 30</td>
        <td>My Cell 10</td>
        <td>My Cell 20</td>
    </tr>
    <tr>
        <td>My Cell 300</td>
        <td>My Cell 100</td>
        <td>My Cell 200</td>
    </tr>
</table>

My problem is sorting the "td"s based on attributes I don't have in current node (col/@index).
The <xsl:sort> command should be put in the "td"s <xsl:for-each> or <xsl:apply-templates> I guess. But how do I point the sort select to the right "col" "index" attribute?
<xsl:sort select="col[...???...]/@index" /> ?

Thanks a lot

Reply With Quote