Using Msxml.createProcessor()
Posted: Mon Jul 31, 2006 9:37 am
Hello,
I have a script i pulled off somewhere that loads an XSL document
Now i have tree sets of XSL fragments that i use to build an html page
Now as you can see the above is the main stylesheet that imports 2 other stylesheet
In Firefox the above application works fine but in IE some where along the line the browser is telling me i dont have a proper stylesheet and it probably not "well formed"
Now somewhere along the line around here
if i do this after the stylesheet property setting it does alert me
can anyone shed some light here on this?
Kendall
I have a script i pulled off somewhere that loads an XSL document
Code: Select all
function loadXslStylesheet(templatePath)
{/* load the XSL template */
try {
var oXmlDom = createDomFromUri(templatePath, true);
} catch (e) {
return false;
}
//if (! parseXmlDom(oXmlDom)) {
// only contuine if the XSL style sheet is valid
// return false;
//}
if ((typeof XSLTProcessor) != "undefined") { // w3c Compliant browsers
var oXslt = new XSLTProcessor();
oXslt.importStylesheet(oXmlDom);
return oXslt;
} else if (window.ActiveXObject) { // Internet Explorer
var xslTemplate = new ActiveXObject("Msxml2.XSLTemplate");
xslTemplate.stylesheet= oXmlDom;
return xslTemplate.createProcessor();
}
}Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- DWXMLSource="../photogallery/photos.xml" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="div_scroll.xsl"/>
<xsl:import href="photo_view.xsl"/>
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="gallery">
<div>
<xsl:for-each select="photo">
<xsl:sort data-type="number" order="ascending" select="@order"/>
<xsl:if test="(@order = 1)">
<xsl:call-template name="photo1"/>
</xsl:if>
<xsl:call-template name="photo"/>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>In Firefox the above application works fine but in IE some where along the line the browser is telling me i dont have a proper stylesheet and it probably not "well formed"
Now somewhere along the line around here
its seems to be returning a undefined...yet when i do avar xslTemplate = new ActiveXObject("Msxml2.XSLTemplate.3.0");
xslTemplate.stylesheet= oXmlDom;
return xslTemplate.createProcessor();
i get an object being alerted yetalert(xslTemplate) before the stylesheet i get a object
if i do this after the stylesheet property setting it does alert me
can anyone shed some light here on this?
Kendall