This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to make the user selecting a view in a XSL stylesheet from a button
- To: "Xsl-List" <xsl-list at mulberrytech dot com>
- Subject: How to make the user selecting a view in a XSL stylesheet from a button
- From: Stéphane Mamdy <smamdy at agrifirst dot com>
- Date: Wed, 9 Aug 2000 15:44:11 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I am using XML through IE 5 with MSXML3.0.
I have this XML document:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml:stylesheet type="text/xsl" href="select_advise.xsl" ?>
<LIST_ADVISE>
<LIST_SUBJECT>
<SUBJECT>Blé tendre</SUBJECT>
<SUBJECT>Graines de colza</SUBJECT>
<SUBJECT>Graines de tournesol</SUBJECT>
<SUBJECT>Maïs</SUBJECT>
<SUBJECT>Orge de mouture</SUBJECT>
<SUBJECT>Pois</SUBJECT>
</LIST_SUBJECT>
<ADVISE ID="133">
<DATE>2000-08-03</DATE>
<CATEGORIE>Céréales</CATEGORIE>
<SUJET>Blé tendre</SUJET>
<COMMENT>comment </COMMENT>
</ADVISE>
<ADVISE ID="135">
<DATE>2000-08-03</DATE>
<CATEGORIE>Céréales</CATEGORIE>
<SUJET>Maïs</SUJET>
<COMMENT>comment</COMMENT>
</ADVISE>
<ADVISE...
...
</ADVISE>
...
</LIST_ADVISE>
I want to propose the user to select what advise he wants to see by
selecting the subject in a list and then clicking on a button. I know how to
construct the select option.
I don't find how to pass the parameter to a xsl variable and to re-process
the xml document.
Does anybody have an idea ?
Here's my xsl document (or parts of it)
-> select_advise.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="mynamespace"
version="1.0">
<xsl:output method="html" version="4.0"/>
<msxsl:script language="JScript" implements-prefix="user">
<![CDATA[
var CATS ="ABC";
function ok(e) {
//THIS CALL DON'T WORK IN A button
// IT WORKS ONLY IN THIS CASE: <xsl:value-of select="user:ok(.)"/>
// I DONT FIND HOW TO USE IT WITH A BUTTON
return "1";
}
]]>
</msxsl:script>
<xsl:template match="/">
<xsl:apply-templates select="LISTE_ADVISE" />
</xsl:template>
<xsl:template match="LISTE_ADVISE">
<H1>Conseils</H1>
<form name="formulaire">
<table CELLPADDING="5" CELLSPACING="0" border="1" bordercolor="#A8D000" >
<tr>
<td>
<table CELLPADDING="0" CELLSPACING="0" width="650">
<tr>
<td>Selectionner un grain</td>
<td> <select name="grain" id="grain">
<option value=""></option>
<xsl:apply-templates select="LISTE_SUBJECT/*" />
</select></td></tr>
<tr><td colspan="2">
<input type="button" onclick="ok(document.forms[0])" value="Submit" />
</td></tr>
</table>
</td></tr></table>
</form>
<table CELLPADDING="5" CELLSPACING="0" border="1" bordercolor="#A8D000" >
<tr>
<td>
...
<xsl:apply-templates select="ADVISE" >
<xsl:sort order="descending" select="DATE"/>
<xsl:sort select="SUJET"/>
</xsl:apply-templates>
....
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="SUBJECT">
<OPTION value="{.}"> <xsl:value-of select="." /></OPTION>
</xsl:template>
<xsl:template match="CONSEIL">
<xsl:value-of select="SUJET"/> ...
<xsl:value-of select="COMMENTAIRE"/>
</xsl:template>
</xsl:stylesheet>
Thanks.
Stéphane Mamdy.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list