Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Iinternet Explorer - MSXML4 versus MSXML6 XSLT Parsing Namespace Error

$
0
0

I saw a lot of posts online about MSXML4 to 6 or XSLT 1.0 versus 2.0 etc. But they could not answer my question.

I have a XSLT transformation code that works with MSXML4 APIs (XSLTransform and FreeThreadedDomDocument) on IE7 via Javascript.

Same code doesnt work with with MSXML6 APIs (XSLTransform and DomDocument) on IE9 via Javascript. It throws this error

"Namespace 'urn:mynamespace:mytable:transactions' does not contain any functions"

I have made sure that my ActiveX are enabled for MSXML4 and 6 both on IE9. Below is the code of the main tranformer XSLT, the reference XSLT & the JS code ...

Core XSLT: functions.xsl

<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxsl="urn:schemas-microsoft-com:xslt"xmlns:myfuncs="urn:mynamespace:mytable:transactions"><msxsl:scriptlanguage="javascript"implements-prefix="myfuncs"><![CDATA[
// convert system GMT time into local time
// usage: <xsl:value-ofselect="myfuncs:localDateTime(datetime)"/>

var openBalance = 0;

function setOpenBalance(openBal)
{
    openBalance = openBal;
}

function getOpenBalance()
{
    openBalance = openBal;
    return openBalance ;
}
]]></msxsl:script></xsl:stylesheet>

Main XSLT: MyTransformer.xsl ... that refers functions.xsl

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxsl="urn:schemas-microsoft-com:xslt"xmlns:myfuncs="urn:mynamespace:mytable:transactions"><xsl:outputmethod="xml"/>

<xsl:includehref="functions.xsl"/><!--<xsl:variable name="trade_cur_bal" select="myfuncs:getOpenBalance(100)"/>--><xsl:templatematch="/"><Response><!-- Some working code here --></Response></xsl:template></xsl:stylesheet>

JS Code

var domXsl  = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");

/*
 // In case of IE9 .... 
 var domXsl  = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0");
*/

var domHTML = new ActiveXObject("Msxml2.XSLTemplate.4.0");
/*
 // In case of IE9 .... 
var domHTML = new ActiveXObject("Msxml2.XSLTemplate.6.0");
*/

domXsl.async=false;
domXsl.load("MyTransformer.xsl");
domHTML.stylesheet = domXsl;

var domData = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
var input = "<MyInputData></MyInputData>"
domData.loadXML(input);

var result = tranform(domHTML, domData); //Works for MSXML 4.0 and fails for MSXML 6.0

function transform(template_, input_) { 
    var output = "";
    if (input_ != null  && input_.xml != "") {
        var proc = template_.createProcessor();
        proc.input = input_;
        proc.transform();
        output = proc.output;
        delete proc;
    }   
    return output;
}

Can someone guide me where am I going wrong w.r.t. MSXML6 or IE9?

Thx.



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>