Altova Mailing List Archives


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

From: St&eacute;phane Mamdy <smamdy@------------->
To:
Date: 8/16/2000 1:59:00 PM
Yes if a don't make any mistake, You may be able doing it with CSS only.
The XSL document must contain HTML and javascript.

The user show or hide some parts of the document by using a button which
runs a javascript function.
This function changes the attributes of HTML parts (using the property
DISPLAY) like <div> or <span>.
The advantage of this is that you can produce code run both on Netscape
Navigators( v 6.x) and IE.

A limitation :
	I think you can't change other things in the document such as the order
sorting...

I haven't used CSS yet...

St&eacute;phane Mamdy.


-----Message d'origine-----
De : owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]De la part de Maulik Modi
Envoy&eacute; : vendredi 11 ao&ucirc;t 2000 20:28
&Agrave; : xsl-list@xxxxxxxxxxxxxxxx
Objet : RE: How to make the user selecting a view in a XSL stylesheet
from a button




Hi,

I am trying to do something similar where I generate tables on the fly by
giving
the user a Select option. However, is there a way to do this for a thin
client
where I do not have to use an ActiveXObject?

ANy help is appreciated.

Thanks,

Maulik




St&eacute;phane Mamdy <smamdy@xxxxxxxxxxxxx> on 08/11/2000 10:12:33 AM

Please respond to xsl-list@xxxxxxxxxxxxxxxx

To:   xsl-list@xxxxxxxxxxxxxxxx
cc:    (bcc: Maulik Modi/Hou-Systems/EnergyTrading/PEC)
Subject:  RE: How to make the user selecting a view in a XSL stylesheet from
a
      button




Yes. Here are the 2 files needed.
It works with IE5 and MSXML 3.0.

But it's not perfect !
I would l like to put in the subject (GRAIN of advise) selection list only
the advise 's subjects (= CONSEIL/SUJET)whitch exist for the selected date
(actually, i list all the subjects without checking if the advise exists at
that date). I don't find how to do that yet.

Your remarks to improve the processing are wellcome...

Maybye this files will give some ideas...

St&eacute;phane Mamdy.


************ conseil.xml ******************
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml:stylesheet type="text/xsl" href="liste_conseils.xsl" ?>
<LISTE_CONSEIL>
<LISTE_DATE>
<DATE_CONSEIL SELECTION="2000/08/01">01/08/2000</DATE_CONSEIL>
<DATE_CONSEIL SELECTION="2000/07/04">04/07/2000</DATE_CONSEIL>
</LISTE_DATE>
<LISTE_GRAIN>
<GRAIN>Bl&eacute; tendre</GRAIN>
<GRAIN>Ma&iuml;s</GRAIN>
<GRAIN>Orge de mouture</GRAIN>
<GRAIN>soja</GRAIN>
</LISTE_GRAIN>
<CONSEIL ID="123">
     <DATE>2000/08/01</DATE> <DATEC>01/08/2000</DATEC>
     <CATEGORIE>C&eacute;r&eacute;ales</CATEGORIE>
     <SUJET>Bl&eacute; tendre</SUJET>
     <ID>Bl&eacute; tendre</ID>
     <COMMENTAIRE>La r&eacute;colte bat son plein avec quelques jours sans
pluie.....</COMMENTAIRE>
</CONSEIL>
<CONSEIL ID="125">
     <DATE>2000/08/01</DATE> <DATEC>01/08/2000</DATEC>
     <CATEGORIE>C&eacute;r&eacute;ales</CATEGORIE>
     <SUJET>Ma&iuml;s</SUJET>
     <ID>Ma&iuml;s</ID>
     <COMMENTAIRE>Peut-on encore parler d'ancienne campagne, tant les
disponibilit&eacute;s sont maigres. ...</COMMENTAIRE>
</CONSEIL>
<CONSEIL ID="124">
     <DATE>2000/08/01</DATE>  <DATEC>01/08/2000</DATEC>
     <CATEGORIE>C&eacute;r&eacute;ales</CATEGORIE>
     <SUJET>Orge de mouture</SUJET>
     <ID>Orge de mouture</ID>
     <COMMENTAIRE>Petite vitesse de croisi&egrave;re car la demande est
r&eacute;duite....</COMMENTAIRE>
</CONSEIL>
<CONSEIL ID="81">
     <DATE>2000/07/04</DATE> <DATEC>04/07/2000</DATEC>
     <CATEGORIE>C&eacute;r&eacute;ale</CATEGORIE>
     <SUJET>Bl&eacute; tendre</SUJET>
     <ID>Bl&eacute; tendre</ID>
     <COMMENTAIRE>La situation ne s'est pas sensiblement am&eacute;lior&eacute;e depuis
mardi.....</COMMENTAIRE>
</CONSEIL>
<CONSEIL ID="83">
     <DATE>2000/07/04</DATE> <DATEC>04/07/2000</DATEC>
     <CATEGORIE>C&eacute;r&eacute;ale</CATEGORIE>
     <SUJET>Ma&iuml;s</SUJET>
     <ID>Ma&iuml;s</ID>
     <COMMENTAIRE>Toujours l'article fort.....</COMMENTAIRE>
</CONSEIL>
<CONSEIL ID="82">
     <DATE>2000/07/04</DATE> <DATEC>04/07/2000</DATEC>
     <CATEGORIE>C&eacute;r&eacute;ale</CATEGORIE>
     <SUJET>Orge de mouture</SUJET>
     <ID>Orge de mouture</ID>
     <COMMENTAIRE>Petit courant d'affaires sur le rapproch&eacute; pour quelques
utilisateurs m&eacute;tropolitains.....</COMMENTAIRE>
</CONSEIL>
<CONSEIL ID="13">
     <DATE>2000/07/04</DATE> <DATEC>04/07/2000</DATEC>
     <CATEGORIE>Ol&eacute;oprot&eacute;agineux</CATEGORIE>
     <SUJET>Graines de colza</SUJET>
     <ID>Graines de colza</ID>
     <COMMENTAIRE>Le retrait mesur&eacute; du dollar depuis la fin de la semaine
derni&egrave;re a calm&eacute; le march&eacute;...</COMMENTAIRE>
</CONSEIL>
</LISTE_CONSEIL>

************ liste_conseils.xsl ******************

<?xml version="1.0" encoding="ISO-8859-1" ?>
<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"/>

<xsl:param name="param" />
<xsl:param name="param_date" />
   <xsl:template match="/">
<HTML>
<HEAD>
     <title>Cotations des cereales</title>
     <style type="text/css">
     .SSTITRE {
          font-weight:bold;
          text-decoration:none;
          };

     .DATE {
          font: 8pt verdana, arial, helvetica, sans-serif; };
     .TJ {
          text-align:justify; };
     </style>

<SCRIPT><xsl:comment><![CDATA[
function Selection_grain(e){

     var tem = new ActiveXObject("MSXML2.XSLTemplate");
     tem.stylesheet = stylesheet;
     var proc = tem.createProcessor();

proc.addParameter("param",e.grain.options[e.grain.selectedIndex].value);

proc.addParameter("param_date",e.date_rapport.options[e.date_rapport.selecte
dIndex].value);
     proc.input = source;
     proc.transform();
     document.body.innerHTML = proc.output;

}
function Selection_date(e) {
     var tem = new ActiveXObject("MSXML2.XSLTemplate");
     tem.stylesheet = stylesheet;
     var proc = tem.createProcessor();

proc.addParameter("param",e.grain.options[e.grain.selectedIndex].value);

proc.addParameter("param_date",e.date_rapport.options[e.date_rapport.selecte
dIndex].value);
     proc.input = source;
     proc.transform();
     document.body.innerHTML = proc.output;

}
]]></xsl:comment></SCRIPT>

<SCRIPT for="window" event="onload"><xsl:comment><![CDATA[

//        stylesheet=document.XSLDocument;
     stylesheet = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
     stylesheet .async = false;
     stylesheet .load("http://agritest:81/cotation/xsl/liste_conseils.xsl");

        source=document.XMLDocument;

]]></xsl:comment></SCRIPT>
     </HEAD>
     <BODY>
     <CENTER>
     <H1>Conseils <xsl:value-of select="$param" />   </H1>
     <xsl:call-template name="CONSTRUCTION-FORMULAIRE" />
     <p/>
     <table>
     <xsl:choose>
          <xsl:when test="$param='' and $param_date=''">
               <xsl:call-template name="AFFICHE-DERNIER" />
          </xsl:when>
          <xsl:when test="$param=''">
               <xsl:apply-templates
select="/LISTE_CONSEIL/CONSEIL[DATE=$param_date]" />
          </xsl:when>
          <xsl:when test="$param_date=''">
               <xsl:apply-templates
select="/LISTE_CONSEIL/CONSEIL[SUJET=$param]" />
          </xsl:when>
          <xsl:otherwise>
               <xsl:apply-templates
select="/LISTE_CONSEIL/CONSEIL[DATE=$param_date and
SUJET=$param]" />
          </xsl:otherwise>
     </xsl:choose>
     </table>

     </CENTER>
     </BODY>
     </HTML>
   </xsl:template>

<xsl:template match="CONSEIL">
     <tr><td> </td><td> </td></tr>
     <tr><td><xsl:value-of select="SUJET"/></td><td align="right"><div
class="DATE"><span class="DATE"><xsl:value-of
select="DATE"/></span></div></td></tr>
     <tr><td> </td><td> </td></tr>
     <tr><td colspan = "2">   <div class="tj"><span class="tj"><xsl:value-of
select="COMMENTAIRE"/> <br/><center><hr
width="200"/></center></span></div></td></tr>
     <tr><td></td><td></td></tr>
</xsl:template>

<xsl:template name="AFFICHE-DERNIER">
<tr><td><p>S&eacute;lectionnez une date et un sujet dans la liste...</p></td></tr>
</xsl:template>

<xsl:template name="AFFICHE-CHOISI">
<p>CHOISI  <xsl:value-of select="$param" /></p>
</xsl:template>


<xsl:template name="CONSTRUCTION-FORMULAIRE">
     <center>
     <form name="formulaire">
     <table CELLPADDING="5" CELLSPACING="0" border="1" bordercolor="#A8D000"
>
     <tr>
     <td>
     <table CELLPADDING="0" CELLSPACING="0" width="650">
     <tr>
     <td>Selectionner une date </td>
     <td> <select name="date_rapport" id="date_rapport"
onchange="Selection_date(document.forms[0])" >
             <option value=""></option>
          <xsl:apply-templates select="LISTE_CONSEIL/LISTE_DATE/*" >
          <xsl:sort data-type="text" order="descending" select="DATE" />
          </xsl:apply-templates>
          </select>
     </td>
     </tr>
     <tr>
     <td>Selectionner un sujet </td>
     <td> <select name="grain" id="grain"
onchange="Selection_grain(document.forms[0])">
             <option value=""></option>
          <xsl:apply-templates select="LISTE_CONSEIL/LISTE_GRAIN/*" >
          <xsl:sort data-type="text" order="ascending" select="." />
          </xsl:apply-templates>
          </select></td></tr>
     <tr><td colspan="2">
<!--      <input type="button" onclick="Selection_grain(document.forms[0])"
value="Selectionner" /> -->
     </td></tr>
     </table>
     </td></tr></table>
     </form>
     </center>
</xsl:template>

<xsl:template match="DATE_CONSEIL">
     <OPTION value="{@SELECTION}"><xsl:if test="@SELECTION =
$param_date"><xsl:attribute
name="SELECTED">1</xsl:attribute></xsl:if><xsl:value-of select="."
/></OPTION>
</xsl:template>

<xsl:template match="GRAIN">
     <OPTION value="{.}"><xsl:if test=". = $param"><xsl:attribute
name="SELECTED">1</xsl:attribute></xsl:if><xsl:value-of select="."
/></OPTION>
</xsl:template>



</xsl:stylesheet>
**************************************************

-----Message d'origine-----
De : owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]De la part de Chris Bayes
Envoy&eacute; : jeudi 10 ao&ucirc;t 2000 22:03
&Agrave; : xsl-list@xxxxxxxxxxxxxxxx
Objet : RE: How to make the user selecting a view in a XSL stylesheet
from a button



>Thanks, Chris
>It works fine !!!
>
>St&eacute;phane Mamdy.

Great ;-)
Can we see the result?

Ciao Chris


 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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.