Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Using XSLT parameters in a browser transform

From: qwerty1234@----------.--- (-----)
To: NULL
Date: 4/2/2004 8:39:00 AM
I would like to be able to re-sort data in an HTML table on the
without returning to the server.  It seems like an XSLT should be able
to accomplish this, but I can't find enough information...

I have am XML file generated on the server that looks something like
this:
<?xml version="1.0" encoding="utf-8" ?> 
<?xml-stylesheet type="text/xsl" href="search.xsl"?>
<AlbumSearch version="3.0" time="02Apr04 10:54:31 EST">
   <SearchResults field="artist" string="Barenaked Ladies">
      <Album artist="Barenaked Ladies" title="Born On A Pirate Ship"
released="1996"/>
      <Album artist="Barenaked Ladies" title="Gordon"
released="1992"/>
      <Album artist="Barenaked Ladies" title="Maroon"
released="2000"/>
      <Album artist="Barenaked Ladies" title="Maybe You Should Drive"
released="1994"/>
   </SearchResults>
</SalesSearch>

Here's my stylesheet:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

   <xsl:template match="/AlbumSearch">
<html>
   <body>
      <xsl:for-each select="SearchResults">
         <table border="1">
            <thead>
               <tr>
                  <th>Artist</th>
                  <th>Title</th>
                  <th>Release Date</th>
               </tr>
            </thead>
            <tbody>
               <xsl:apply-templates>
                  <xsl:sort select="@artist"/>
               </xsl:apply-templates>
            </tbody>
         </table>   
      </xsl:for-each>

      </body>
   </html>   
   </xsl:template>
   
   <xsl:template match="Album">
      <tr>
         <td><xsl:value-of select="@artist"/></td>
         <td><xsl:value-of select="@title"/></td>
         <td><xsl:value-of select="@released"/></td>
      </tr>
   </xsl:template>
</xsl:stylesheet>
  
The idea is to transform this into HTML on the client, placing the
album list into an HTML table.  What I'd like to accomplish is to
include links or buttons in each column header that would allow the
user to click on them and resort the album list by that column without
round-tripping to the server.  The stylesheet I currently have
obvisouly hardcodes the sort order; I'd like to determine the sort
order based on the user's selection.

Anyone have any ideas?  Would using a little bit of script to kick off
a new transform work, passing a parameter based on which column the
user kicked?
Where can I find an example?


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent