Click here to Skip to main content
13,734,094 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
<<pre lang="xml"><pre lang="xml">?xml version="1.0" encoding="UTF-8"?>
<ExperimentalSets>
  <ExperimentalSet GUID="Set01">
    <Identity>
      <Name>The First Experimental Set</Name>
      <Description/>
    </Identity>
    <Experiments OrderBy="Value">
      <Experiment GUID="Expt0009" DesignIndex="15" RunIndex="12">11</Experiment>
      <Experiment GUID="Expt0014" DesignIndex="14" RunIndex="7" >25</Experiment>
      <Experiment GUID="Expt0013" DesignIndex="13" RunIndex="3" >37</Experiment>
      <Experiment GUID="Expt0012" DesignIndex="12" RunIndex="1" >41</Experiment>
      <Experiment GUID="Expt0011" DesignIndex="11" RunIndex="5" >54</Experiment>
      <Experiment GUID="Expt0010" DesignIndex="10" RunIndex="9" >69</Experiment>
    </Experiments>
  </ExperimentalSet>
  <ExperimentalSet GUID="Set02">
    <Identity>
      <Name>The Second Experimental Set</Name>
      <Description/>
    </Identity>
    <Experiments OrderBy="Run Index">
      <Experiment GUID="Expt1012" DesignIndex="12" RunIndex="1" >1004</Experiment>
      <Experiment GUID="Expt1005" DesignIndex="5"  RunIndex="2" >1102</Experiment>
      <Experiment GUID="Expt1013" DesignIndex="13" RunIndex="3" >1324</Experiment>
      <Experiment GUID="Expt1007" DesignIndex="7"  RunIndex="4" >1921</Experiment>
      <Experiment GUID="Expt1011" DesignIndex="11" RunIndex="5" >1245</Experiment>
    </Experiments>
  </ExperimentalSet>
</ExperimentalSets>

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="ExperimentalSets">
      <html>
        <body>
          <script type="text/JavaScript">
            function parsingAttributes(control)
            {
            var ctr= document.getElementById(control.text);
            ctr.style.display='block';
            }
            function sortByNumber(divid,txt)
            {

            }
          </script>
          <xsl:apply-templates select="ExperimentalSet">
           </xsl:apply-templates>
        </body>
      </html>
    </xsl:template>
  <xsl:template match ="ExperimentalSet">
    <xsl:variable name="NodeName">
      <xsl:value-of select="Identity/Name"/>
    </xsl:variable>
  <a href="#" onclick="parsingAttributes(this)">
    <xsl:value-of select="Identity/Name"/>
  </a>
    <div id="{$NodeName}" style="display:none">
      <table border="4">
        <tr>
          <th onclick="sortByNumber('{$NodeName}',this)">Number</th>
          <th>GUID</th>
          <th>Design Index</th>
          <th>Run Index</th>
        </tr>

        <xsl:for-each select ="Experiments/Experiment">
          <tr>
            <td>
              <xsl:value-of select ="text()"/>
            </td>
            <td>
              <xsl:value-of select ="@GUID"/>
            </td>
            <td>
              <xsl:value-of select ="@DesignIndex"/>
            </td>
            <td>
              <xsl:value-of select ="@RunIndex"/>
            </td>
          </tr>
        </xsl:for-each>
       </table>
    </div>

  <br />
  </xsl:template>
</xsl:stylesheet

>

the related xsl file is the one shown above.
The need is to sort the html table contents based on the column clicks provided by the user.

This has to be done dynamically based on the user clicks.
i.e. if the user clicks on Number the contents are to be sorted based on number,if the user clicks on Design Index the data has to be sorted by design Index..

In short how do we sort the data dynamically based on events like the onclick in xslt.


Kindly post in your suggestions.
Posted 17-Jan-11 16:36pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,
Please refer following link
Make all your tables sortable[^]

Thanks,
Imdadhusen
  Permalink  
Comments
VarunKumarGB 18-Jan-11 3:58am
   
Thanks Sunasara

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06-2016 | 2.8.180920.1 | Last Updated 17 Jan 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100