![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Using XSLT parameters in a browser transform Using XSLT parameters in a browser transformTo: 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? | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
