Subject: RE: [xsl] xsl:param and MSXML From: "stevenson" <stevenson@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 15 Mar 2002 16:24:49 +0300 |
I have been learning XML and this is almost my third month. Just try this: var objCompiled = new ActiveXObject("Msxml2.XSLTemplate.4.0") objCompiled.stylesheet = oCallsXSL // create XSL-processor var objXSLProc = objCompiled.createProcessor() // input for XSL-processor objXSLProc.input = oFilteredXML objXSLProc.addParameter("element", param); objXSLProc.transform(); var str = objXSLProc.output; -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Aedemar Cooke Sent: 15 March 2002 15:51 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] xsl:param and MSXML Hi, I wrote/adapted the following javascript to enable my xsl read parameters from the calling URL but I am having a problem getting it to work. function passParameter(param){ try{ var s = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); var x = document.XMLDocument; if (x == null){ x = navigator.XMLDocument; s.loadXML(navigator.XSLDocument.xml); }else{ s.loadXML(document.XSLDocument.xml); } var tem = new ActiveXObject("MSXML2.XSLTemplate"); tem.stylesheet = s; var proc = tem.createProcessor(); proc.addParameter("element", param); proc.input = x; proc.transform(); var str = proc.output; var newDoc = document.open("text/html", "replace"); newDoc.write(str); navigator.XMLDocument = x; navigator.XSLDocument = s; newDoc.close(); }catch(exception){} } I have an xml file called atozindex.xml that is associated with the server-config file atoz.xml. The server config file calls the atoz.xsl stylesheet which has the javascript embedded and has links which should invoke the passParameter function. An exception is thrown in the JavaScript but the message is just Object Error. I copied the javascript from an example off the www.bayes.co.uk/xml site given for page breaking, so I would assume that is correct. I am just wondering if there is something that has to be configured in order to get the Javascript to work. Any advice would be appreciated... Thanks, Aedemar -----Original Message----- From: cutlass [mailto:cutlass@xxxxxxxxxxx] Sent: 14 March 2002 15:38 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] xsl:param and MSXML Hello Ademar, the technique for injecting a parameter is processor specific. for IE u will need to use javascript code to instantiate xml and xsl object and use a method to add parameter ( no a param is not passed via URL that is neither GET nor POST will not do a thing, as it does in other frameworks or processors ). check out one of tutorials at www.bayes.co.uk/xml on filtering, should be very clear. cheers, jim fuller ----- Original Message ----- From: "Aedemar Cooke" <Aedemar.Cooke@xxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, March 14, 2002 3:28 PM Subject: [xsl] xsl:param and MSXML > Hi, > I want to read a parameter from the URL and use it in my stylesheet as > displayed below > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:param name="element"/> > > <xsl:template match="/"> > <xsl:apply-templates select="/content/*[name()=$element]" > mode="wysiwyg"/> > </xsl:template> > > <xsl:template match="element1"> > <xsl:copy-of select="."/> > </xsl:template> > > <xsl:template match="element2"> > <xsl:copy-of select="."/> > </xsl:template> > > </xsl:stylesheet> > > I was using a cocoon parser to parse by XSL and my code worked fine but > then had to change to use MSXML. > > Can anyone tell me how to implement it so that it will work with MSXML. > > Thanks, > Aedemar > > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl:param and MSXML, Aedemar Cooke | Thread | AW: [xsl] exlt set.distinct.templat, "Braumüller, Hans" |
[xsl] script tag in xsl, stevenson | Date | Re: [xsl] script tag in xsl, Joerg Heinicke |
Month |