I am trying to create XSL document that can;
1) accept a URL parameter such as C:/xml/detail.xml?TaskID=1.20
2) filter the XML data on the specified value paramter
3) work on the client side (IE 5/6) only
I have seen many methods of doing this on an ASP server, but this needs to work on the client/browser . I am having trouble find out how to parse the URL (not difficuly in itself in javascript) and pass the parameter into an XSLT variable ( shown as $CurrentTask in the code below - much more difficult! ).
How do I get my XSL document to just output all the 1.20 IDs based on the TaskID parameter ?
Short of outputing my XML into 26 different files and referencing each individually (instead of referencing a single file with a parameter), I dont know how to get this to work.
Any assitance (no matter how small) would be much appreciated!
Many thanks,
J.
---------------------------- XML style sheet --------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="detail.xsl"?>
<root>
<WSum><ID>1.10</ID><D>Information line 1</D></WSum>
<WSum><ID>1.10</ID><D>Information line 2</D></WSum>
<WSum><ID>1.10</ID><D>Information line 3</D></WSum>
<WSum><ID>1.10</ID><D>Information line 4</D></WSum>
<WSum><ID>1.20</ID><D>Information line 1</D></WSum>
<WSum><ID>1.20</ID><D>Information line 2</D></WSum>
<WSum><ID>1.20</ID><D>Information line 3</D></WSum>
<WSum><ID>1.20</ID><D>Information line 4</D></WSum>
</D></WSum>
</root>
---------------------------- XSL style sheet --------------------------------
<html>
<head>
</head>
<body>
<h2>Details</h2>
<table border="0">
<tr bgcolor="gray">
<th align="left">TID</th>
<th align="left">Description</th>
</tr>
<xsl:for-each select="root/WSum">
<xsl:choose>
<xsl:when test="(ID = $CurrentTask)">
<!-- display my table rows here -->
<td><xsl:value-of select="ID"/></td>
<td><xsl:value-of select="D"/></td>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</body></html></xsl:template></xsl:stylesheet>
Cheers
John (Sudmill)
1) accept a URL parameter such as C:/xml/detail.xml?TaskID=1.20
2) filter the XML data on the specified value paramter
3) work on the client side (IE 5/6) only
I have seen many methods of doing this on an ASP server, but this needs to work on the client/browser . I am having trouble find out how to parse the URL (not difficuly in itself in javascript) and pass the parameter into an XSLT variable ( shown as $CurrentTask in the code below - much more difficult! ).
How do I get my XSL document to just output all the 1.20 IDs based on the TaskID parameter ?
Short of outputing my XML into 26 different files and referencing each individually (instead of referencing a single file with a parameter), I dont know how to get this to work.
Any assitance (no matter how small) would be much appreciated!
Many thanks,
J.
---------------------------- XML style sheet --------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="detail.xsl"?>
<root>
<WSum><ID>1.10</ID><D>Information line 1</D></WSum>
<WSum><ID>1.10</ID><D>Information line 2</D></WSum>
<WSum><ID>1.10</ID><D>Information line 3</D></WSum>
<WSum><ID>1.10</ID><D>Information line 4</D></WSum>
<WSum><ID>1.20</ID><D>Information line 1</D></WSum>
<WSum><ID>1.20</ID><D>Information line 2</D></WSum>
<WSum><ID>1.20</ID><D>Information line 3</D></WSum>
<WSum><ID>1.20</ID><D>Information line 4</D></WSum>
</D></WSum>
</root>
---------------------------- XSL style sheet --------------------------------
<html>
<head>
</head>
<body>
<h2>Details</h2>
<table border="0">
<tr bgcolor="gray">
<th align="left">TID</th>
<th align="left">Description</th>
</tr>
<xsl:for-each select="root/WSum">
<xsl:choose>
<xsl:when test="(ID = $CurrentTask)">
<!-- display my table rows here -->
<td><xsl:value-of select="ID"/></td>
<td><xsl:value-of select="D"/></td>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</body></html></xsl:template></xsl:stylesheet>
Cheers
John (Sudmill)