xsl-list
[Top] [All Lists]

RE: Passing parameters to XSL

2002-12-19 11:33:15
Hi,
I am not sure if this code would help you, but I'm using this code with
XMetal Editor, passing three parameters from a html form to XSLT (using
msxml4.0, IE5.5), to transform a specific part of the XML document to a
HTML page. 

Let me know if you need more information.

Cihan

----------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
...
<html>
<head>
....
<script language="javascript"><![CDATA[
function butCheckForm_onclick()
{]]>
        <xsl:text>var xmlurl =("</xsl:text><xsl:value-of
select="$xmllocation"/><xsl:text>");</xsl:text>
        <![CDATA[
      var xmldoc = new ActiveXObject("MSXML2.DOMDocument");
        xmldoc.async = false;
        xmldoc.load(xmlurl);
    // Load the XSL stylesheet
        var xslt = new ActiveXObject("MSXML2.XSLTemplate.4.0");
      var xsldoc = new
ActiveXObject("MSXML2.FreeThreadedDOMDocument.4.0");
        var xslProc;
        var xslurl = ("your.xsl");
        xsldoc.async = false;
        xsldoc.load(xslurl);
        xslt.stylesheet = xsldoc;
        xslProc = xslt.createProcessor();
        xslProc.input = xmldoc;
        var modNum = document.forms[0].txtMod.value;
        var secNum = document.forms[0].txtSec.value;
        var scrNum = document.forms[0].txtScr.value;
      xslProc.addParameter("moduleNum", modNum);
        xslProc.addParameter("sectionNum", secNum);
        xslProc.addParameter("screenNum", scrNum);
        xslProc.transform();
        targ.innerHTML = xslProc.output;
}
]]></script>
</head>
<body bgcolor="#F5F4F1" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0">
<form NAME="form1">
  <table width="100%" border="0" cellspacing="0" cellpadding="2">
                    <!--deleted some code here -->
                    <select name="txtMod" onChange="txtMod_onChange()">
                <option value="00">00</option>
                <option value="01">01</option>
                ...
              </select>
              _
              <select name="txtSec" onChange="txtSec_onChange()">
                <option value="000">000</option>
                <option value="010">010</option>
                <option value="015">015</option>
                ....
              </select>
              _
              <select name="txtScr" onChange="txtScr_onChange()">
                <option value="000">000</option>
                <option value="010">010</option>
                ...
              </select> 
<INPUT TYPE="button" VALUE="Preview Page" NAME="butCheckForm"
onclick="butCheckForm_onclick();"/>
        .....   
        </table></td>
  </tr>
</table>
</form>
<div id="targ">[Transformed data will appear here]</div>
</body>
</html>
        <xsl:apply-templates/>
</xsl:template>
<xsl:template match="*|@*"/>
</xsl:stylesheet>
------------------------------

-----Original Message-----
From: AWK [mailto:ncam_tech(_at_)wgbh(_dot_)org]
Sent: Thursday, December 19, 2002 11:37 AM
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Passing parameters to XSL


Is there any way to pass parameter values to an XSL stylesheet (from an
xhtml file?) when using IE6 as the parser?  I know how to pass the value
with xalan, but not IE.

Thanks in advance,
AWK


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

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



<Prev in Thread] Current Thread [Next in Thread>