I loaded a XSLT stylesheet into a XMLDocument to retrieve some of the data.
I received an exception when the SelectNodes method was invoked. The
message was "System.Xml.XPath.XPathException - Namespace Manager or
XsltContext needed. This query has a prefix, variable, or user-defined
function."
Q324899
I queried MSDN for Namespace Manager and found this article: "Manage
namespaces Using the XmlNamespace Manager"
http://msdn.microsoft.com/library/de...aceManager.asp
So, based upon the article, I modified my code to look like this:
TemplateDoc = New Xml.XmlDocument
TemplateDoc.Load(Filename)
Manager = New Xml.XmlNamespaceManager(TemplateDoc.NameTable)
' also tried this...
' Manager.AddNamespace("mbe", "http://dummy.com")
Manager.AddNamespace("xmlns:mbe", "http://dummy.com")
Manager.PushScope()
Nodes = TemplateDoc.SelectNodes("//mbe:Parameters/parameter")
But, I'm still getting the exception. Anyone have any suggestions?
For what it's worth, I also queried MSDN for XsltContext. The web page for
XsltContext said to refer to Q324899 for more information. Querying on
Q324899 just brought me back to the link above.
Richard
P.S.
Here's what the file looks like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:mbe="http://dummy.com">
<mbe:Parameters>
<parameter name="value1" required="yes" />
<parameter name="value2" />
</mbe:Parameters>
<xsl:output method="html" />
<xsl:template match="*" >
<html>
<body>
Sample Table
<table>
<xsl:for-each select="Data">
<tr>
<td>Title: </td>
<td><xsl:value-of select="Title" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>