[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Sortable data-table

Subject: Sortable data-table
From: "Koetje Boe" <b_koetje@xxxxxxxxxxx>
Date: Wed, 27 Dec 2000 13:38:21 -0000
sortable data table

Hi, I have a xml-file that respresents a data table, and a xsl-file that shows this table. What I want to do is this: When a column header is pressed(it`s a button) sort the resulting html-page on that column. For example, my xml-file looks like:

<?xml version="1.0" encoding="ISO8859-1"?>
<!DOCTYPE dataset PUBLIC 'datasetDTD' http://localhost/xmlDocs/dataset.dtd'>
<?xml-stylesheet type="text/xsl" href="http://localhost/xmlDocs/dataset.xsl"?>
<?cocoon-process type="xslt"?>


<dataset>
 <metaData>
   <tableName>EMPLOYEES</tableName>
   <columnInfo name="EMP_NO" type="SmallInt" size="6"/>
   <columnInfo name="FIRST_NAME" type="VarChar" size="15"/>
   <columnInfo name="LAST_NAME" type="VarChar" size="20"/>
 </metaData>
 <data>
   <row>
     <column name="EMP_NO">2</column>
     <column name="FIRST_NAME">Robert</column>
     <column name="LAST_NAME">Nelson</column>
   </row>
   <row>
     <column name="FIRST_NAME">K. J.</column>
     <column name="LAST_NAME">Weston</column>
     <column name="EMP_NO">11</column>
   </row>
   <row>
     <column name="FIRST_NAME">Luke</column>
     <column name="EMP_NO">61</column>
     <column name="LAST_NAME">Leung</column>
   </row>
 </data>
</dataset>

And my xsl-file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" indent="yes"/>
<xsl:template match="/">
<xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
<html>
<body>
<table border="1" width="60%" bgcolor="WHITE" cellspacing="2" cellpadding="2" frame="border">
<caption>
<xsl:value-of select="dataset/metaData/tableName"/>
</caption>
<tr>
<xsl:for-each select="dataset/metaData/columnInfo">
<th>
<INPUT>
<xsl:attribute name="TYPE">SUBMIT</xsl:attribute>
<xsl:attribute name="VALUE">
<xsl:value-of select="@name"/>
</xsl:attribute>
</INPUT>
</th>
</xsl:for-each>
</tr>
<xsl:for-each select="dataset/data/row">
<xsl:variable name="row" select="."/>
<tr>
<xsl:for-each select="/dataset/metaData/columnInfo">
<td>
<xsl:value-of select="$row/column[@name = current()/@name]"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


It there a way to do this? And if so, how?
Any suggestions and/or examples are greatly appreciated.

J.S. Koldenhof
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.