Subject: [xsl] Question about MS setProperty method From: Chuck White <chuckwh@xxxxxxxxxxx> Date: Wed, 23 Oct 2002 07:37:19 -0700 |
My apologies in advance for this vendor-specific question, but this is really the best place to ask. In creating a client-side web app that calls templates dynamically, I have found that I can successfully change the name of a called template dynamically, but I have to use a match pattern in the selectSingleNode method for some reason. If I try to use the setProperty method to set the language to XPath, I get an error message saying "Reference to undeclared namespace prefix xsl" However, if I leave it off and go with the default language (XSL Patterns, according to the MSDN site), it works fine. So this works fine: <script language="JScript"> function chngNode(xPath, xValue) { xmlDoc = document.XMLDocument; xslDoc = document.XSLDocument; var matchString = xslDoc.selectSingleNode(xPath); matchString.text = xValue; output.innerHTML = xmlDoc.documentElement.transformNode(xslDoc); //This resets the call-template name to "content" //Otherwise, the preceding change // kills it, and the script looks for it, // so leaving it off results in an error matchString.text = "content"; } </script> But this doesn't: <script language="JScript"> function chngNode(xPath, xValue) { xmlDoc = document.XMLDocument; xslDoc = document.XSLDocument; // this next line is the offendor // and results in the namespace error xslDoc.setProperty("SelectionLanguage", "XPath"); var matchString = xslDoc.selectSingleNode(xPath); matchString.text = xValue; output.innerHTML = xmlDoc.documentElement.transformNode(xslDoc); //This resets the call-template name to "content" //Otherwise, the preceding change // kills it, and the script looks for it, // so leaving it off results in an error matchString.text = "content"; } </script> Anyone out there understand what is happening under the hood to make the second fail? It doesn't matter for the app I'm working on, since it works, but being relegated to selecting only patterns makes it harder to pass parameters client-side when complex interactions are involved. My guess is that somehow since you're changing the language to XPath, you're basically removing the wired-in xsl namespace, but that's purely a guess. Thanks in advance! Cheers, Chuck White ------------------------- Author, Mastering XSLT, Sybex Books Co-Author, Mastering XML Premium Edition, Sybex Books http://www.javertising.com/webtech/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] IE 5.5 - special characte, Chuck White | Thread | RE: [xsl] Question about MS setProp, Marrow |
RE: [xsl] XML in IE6, Mike Ferrando | Date | Re: [xsl] backwards tree-traversal , Jeni Tennison |
Month |