This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How to make the user selecting a view in a XSL stylesheet from a button


Thanks, Chris
It works fine !!!

Stéphane Mamdy.

-----Message d'origine-----
De : owner-xsl-list@mulberrytech.com
[mailto:owner-xsl-list@mulberrytech.com]De la part de Chris Bayes
Envoyé : jeudi 10 août 2000 10:00
À : xsl-list@mulberrytech.com
Objet : RE: How to make the user selecting a view in a XSL stylesheet
from a button


Yup there are many ways to do it. As for changing the view you could try
something like:-
function ok(obj){
	var x = new ActiveXObject("MSXML2.DOMDocument");
	var s = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	var tem = new ActiveXObject("MSXML2.XSLTemplate");
	var proc = null;
	x.async = false
	x.validateOnParse = false;
	s.async = false
	x.load(xmlFile);
	s.load(xslFile);
	tem.stylesheet = s;
	proc = tem.createProcessor();
	proc.addParameter("param",obj.value);
	proc.input = x;
	proc.transform();
	document.body.innerHTML = proc.output;
}
and many variations on this theme. Check out the utils section of the portal
for other examples.

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


>I found another solution too :
><BUTTON value="ok" >
>        <xsl:attribute name="onClick">ok(this)</xsl:attribute>
></BUTTON>
>
>
>but it doesn't solve all the problem.
>I need to change a xsl variable on the call of the function ok(), put the
>value of the selected subjet in this variable and the re-apply the
>transformation to present only the advise matching the subject....
>
>
>
>-----Message d'origine-----
>De : owner-xsl-list@mulberrytech.com
>[mailto:owner-xsl-list@mulberrytech.com]De la part de Chris Bayes
>Envoyé : mercredi 9 août 2000 17:57
>À : xsl-list@mulberrytech.com
>Objet : RE: How to make the user selecting a view in a XSL stylesheet
>from a button
>
>
>Stéphane,
>Your problem is that you have specified the script to run as part of the
>transform when you want it to run after the transform.
>Change it to something like:-
>
><xsl:template match="LISTE_ADVISE">
><script language="JScript">
><![CDATA[     
>var CATS ="ABC";
>    function ok(e) {
>	alert("button clicked");
>	return  "1";
>    }
>  ]]> 
></script>
>	<H1>Conseils</H1>
><snip/>
>	<input type="button" onclick="ok(this)" value="Submit" />
>
>
>
>
>
>Ciao Chris
>
>XML/XSL Portal 
>http://www.bayes.co.uk/xml
>>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
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]