the xsl code that i have written to display the above xml content in
table format. In that code itself i have written the code to dynamically
sort the table data. but it is not properly working.
when i use the static variable instead of that dynamic variable. it is
working nice.
<!-- creates the table headers from the tag names -->
<xsl:template name="header">
<tr>
<xsl:for-each select="*/*[1]/*">
<th>
<A href="{$Page} ?Sor={position()}">
<xsl:value-of select="local-name(.)" />
</A>
</th>
</xsl:for-each>
</tr>
</xsl:template>
<!-- creates a row for each child of root, -->
<!-- and cell for each grandchild of root -->
<xsl:template name="content" match="*/*">
<tr>
<xsl:for-each select="*">
<td><xsl:value-of select="." /></td>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>
inaddition to this i have written some code in jsp to integrate both xml
and xsl code..
jsp code that i have written is
<html>
<body>
<script type="text/javascript">// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = true
xml.load("data.xml")
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = true
xsl.load("xslsort.xsl")
2) This is the Active Server Page that run the stylesheet.
The result is a HTML page with a clickable header to do sorting
<%@ LANGUAGE = jscript %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Sortable Table</title>
</head>
<body>
<%
var sortby = Request.QueryString("sortby");
var xmlpath = Server.mappath("sorttable.xml");
var xslpath = Server.mappath("sorttable.xsl");
var xslt = new ActiveXObject("Msxml2.XSLTemplate.4.0");
var xsldoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
var xmldoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var xslproc;