[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Question about MS setProperty method

Subject: Question about MS setProperty method
From: Chuck White <chuckwh@xxxxxxxxxxx>
Date: Wed, 23 Oct 2002 07:37:19 -0700
setproperty xpath
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.