Subject: [xsl] Passing a Parameter to XSL from an ASPX page From: Riju Abraham <R.Abraham@xxxxxxxxxxxx> Date: Fri, 16 Jan 2004 09:37:07 +0300 |
Hi Can some one help me with how to pass a parameter froom an aspx page to an xsl file to do the dynamic sorting . I have done it ..but I am not able to create the MSXML2.XSLTemplate. If I run the page I am getting the error "The xsltemplate object is null or empty". Can some one help me out of this... Thanx in advance.. ASPX Page ---------------------------------------------------------------------------- -------------------------------------- <script language="javascript"> var strXMLFileName,strXSLFileName; var objXMLDoc,objXSLDoc,objXSLTemplateNae; var currentSortDirection="ascending"; var currentSortCol=""; strXMLFileName="KSAArea.xml"; strXSLFileName="KSAArea.xsl"; function OnInitPage() { objXMLDoc = new ActiveXObject("MSXML2.DOMDocument"); //objXMLDoc.async = false; //This is necessary to use XPath in selectSingleNode and selectNodes methods // For backwards compatibility, XSL Patterns are default. //objXMLDoc.setProperty("SelectionLanguage", "XPath"); //objXMLDoc.resolveExternals = false; //objXMLDoc.validateOnParse = false; objXMLDoc.load(strXMLFileName); objXSLDoc = new ActiveXObject("MSXML2.FreeThreadedDomDocument"); //objXSLDoc.async = false; //objXSLDoc.resolveExternals = false; //objXMLDoc.validateOnParse = false; objXSLDoc.load(strXSLFileName); window.alert(strXSLFileName); window.alert("Inside InitPage 1"); objXSLTemplate = new ActiveXObject("MSXML2.XSLTemplate"); //Here I am getting the ERROR .The OBJXSLTemplate object is NUll or empty.. window.alert("Inside InitPage 2"); objXSLTemplate.stylesheet = objXSLDoc; window.alert("Inside InitPage3"); ClickedMe("Area"); } function ClickedMe(strSort) { var objXSLProcessor; window.alert("UserClicked on 1 " + strSort); objXSLProcessor=objXSLTemplate.createProcessor(); window.alert("UserClicked on 2 " + strSort); objXSLProcessor.input=objXMLDoc; window.alert("UserClicked on 3 " + strSort); objXSLProcessor.addParameter("sortBy",strSort); window.alert("UserClicked on 4 " + strSort); } window.onload=OnInitPage; </script> ---------------------------------------------------------------------------- -------------------------------- The XSL FILE <xsl:transform version="1.0" xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl ="urn:schemas-microsoft-com:xslt"> <xsl:output method="html"></xsl:output> <xsl:param name ="sortBy">country</xsl:param> <xsl:template match="/"> <html> <body> <div align ="left"> Sort By: <xsl:value-of select="$sortBy"></xsl:value-of> </div> <table width="210" border="2pt" cellspacing="0" cellpadding="3" bordercolor="#dddddd" style="border-collapse:collapse;"> <tr bgcolor="#9acd32"> <th align="Left"><a class="clickanchor" onclick="ClickedMe('Country');" >Country</a></th> <th align="Left"><a class="clickanchor" onclick="ClickedMe('AreaCode');" >AreaCode</a></th> <th align="Left"><a class="clickanchor" onclick="ClickedMe('AreaDescription');">AreaDescription</a></th> </tr> <xsl:for-each select ='locations/area'> <xsl:sort select="areadescription"/> <tr> <td class="Normal"> <center> <xsl:value-of select ='country'/> </center> </td> <td class="Normal"> <center> <xsl:value-of select ='areacode'/> </center> </td> <td class="Normal"> <left> <xsl:value-of select ='areadescription'/> </left> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:transform> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] The real harm is in funct, Mike Haarman | Thread | Re: [xsl] Passing a Parameter to XS, M. David Peterson |
[xsl] The real harm is in functions, Dimitre Novatchev | Date | [xsl] position()=last() always 1 pr, Donal Regan |
Month |