[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Question about MS setProperty method
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|