Click to See Complete Forum and Search --> : IE not accepting my XSL


alabast
01-23-2010, 07:01 PM
I've got an AJAX page that is transforming responseXML using an xsl stylesheet using (in IE) the transformNode function (firefox uses an XSLTProcessor). Problem is IE is throwing an error "The stylesheet does not contain a document element"; it doesn't seem to think the document is well-formed. The page works fine in firefox.

I can't find the problem, but here's the whole xsl document. If someone knows something I don't, I'd appreciate it some help.


<?xml version="1.0" encoding="utf-8"?>
<!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:output method="html" encoding="utf-8" />
<xsl:variable name="pageid">
<xsl:value-of select="/main/@id" />
</xsl:variable>

<xsl:template match="/">
<div class="pageMenu">
<xsl:for-each select="main/listing" >
<div style="background:#fff; cursor:pointer;" class="pageMenuOption" onclick="loadXML('{$pageid}','{@id}')">
<xsl:value-of select="@name" />
</div>

</xsl:for-each>
<div id="pageContent" class="pageContent">
Select a hero!
</div>
</div>

</xsl:template>

<xsl:template match="/main/listing">
<h3><xsl:value-of select="@name" /></h3>
<xsl:value-of select="/main/listing" />
<div id="illustration" class="illustration"><img src="images/{@id}_heroic.jpg" /></div>
</xsl:template>

</xsl:stylesheet>

Webnerd
01-23-2010, 11:06 PM
Try changing this:

<!DOCTYPE xsl:stylesheet

to this

<!DOCTYPE stylesheet


Also, are you looking to replace the entities with HTML encoded values or their UTF-8 equivalent. If you want to replace with entity declarations, try something like this:

<!DOCTYPE stylesheet [
<!ENTITY mdash
"<xsl:text disable-output-escaping='yes'>&amp;mdash;</xsl:text>">
]>

alabast
01-23-2010, 11:36 PM
I got rid of the xsl:, but it changed nothing. As for the entity stuff, that's just stuff Dreamweaver put in their automatically. Could it be causing the problem?

alabast
01-25-2010, 09:07 PM
I figured out the problem, it was with the function I was loading the xsl with. Thanks anyway!