Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespace error

Status
Not open for further replies.

Muddmuse

Programmer
Jul 31, 2001
85
0
0
US
I'm attempting to load an xsl file into the DOM (&quot;MSXML2.DOMDocument.4.0&quot;) and modify the &quot;select&quot; attribute on a <xsl:sort/> node like this:

Set objSortNode = xslObj.documentElement.selectSingleNode(&quot;//xsl:sort&quot;)

I'm getting the following error:

&quot;Reference to undeclared namespace prefix: 'xsl'&quot;

Here is my stylesheet:

<?xml version=&quot;1.0&quot;?>
<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot; <xsl:template match=&quot;/&quot;>
<!-- do stuff here -->
</xsl:template>
</xsl:stylesheet>

I am declaring the namespace so why am I getting this error?
 
Hi Muddmuse,

I've had simular problems reading an XSD. Code that worked fine with the 3.0 parser didn't work with the 4.0 parser. I still haven't found the solution but I think it has something to do with the default query language MS uses with the 4.0 parser.

Script Syntax:
var objXMLDOMNode = oXMLDOMNode.selectSingleNode(queryString);

Parameters
queryString
A string specifying the pattern-matching operation to be applied. This string is an XPath expression only if the setProperty method has set the SelectionLanguage internal property (flag) to &quot;XPath&quot;. Otherwise, this string is an XSL Patterns query.

So try setting the SelectionLanguage property to XPath first.

Good luck!

Jordi Reineman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top