Update: Removing the DocType entity in the xslt resolves this problem.


Upon downloading the latest Xml Notepad, I decided to to a quickie transformation. When I did that I got this error message:

Error Transforming XML

XSLT compile error. For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method.

Is this a problem with my XSLT or is it a problem with the editor. Note I can transform in Visual Studio with no problems and my .Net code that consumes the xml and XSLT transforms flawlessly…

Steps to reproduce, note for #4 one will need to create a file for the XSLT.

  1. Select New File button to clear. (Important)
  2. Paste the xml into the Xml area.
  3. Click on the XSL output.
  4. Browse to the XSLT location.
  5. Click Transform.
Xml
<?xml version="1.0"?>

<MigrationReport>

  <Completed>

    <Phase ID="-1" Status="Success">

      <Accounts>

        <Account ID="86753" Status="Success">

          <Portfolios>

            <Portfolio ID="8675309" Type="A" Description="" Target="N/A" Status="Success">

              <Reports>

                <Report Bytes="1121875" Directory="S:Working DirectoryBalances_03232007.txt">(1121875) written for S:Working DirectoryBalances_03232007.txt</Report>

              </Reports>

            </Portfolio>

          </Portfolios>

        </Account>

      </Accounts>

    </Phase>

  </Completed>

</MigrationReport>
XSLT

<?xml version=”1.0encoding=”utf-8?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp “ >
]><xsl:stylesheet version=”1.0
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform>
<xsl:output method=”htmlversion=”4.0encoding=”UTF-8indent=”yesmedia-type=”text/html“/>
<xsl:template match=”MigrationReport/Completed> <html>
<body>
<h1 style=”background: #708090; color: #F4F5E9; font-variant: small-caps; letter-spacing: 4px; margin-left: 10%; margin-right: 10%; padding-bottom: 10px; padding-top: 10px; text-align: center; text-decoration: none;>Migration Report</h1>
<xsl:apply-templates select=”Phase“/>
<hr/>
</body>
</html>
</xsl:template>
<xsl:template match=”Phase><hr/>
<h3>
Phase <xsl:value-of select=”@ID“/>
<xsl:text
disable-output-escaping=”yes>&nbsp;&nbsp;</xsl:text>(<xsl:value-of select=”@Status“/>)
</h3><xsl:apply-templates select=”Accounts/Account“/><!– <xsl:apply-templates select=”ID“/>
<xsl:apply-templates select=”attributes“/>>

</xsl:template>

<xsl:template match=”Account>
<fieldset style=”margin-left: 9%;>
<legend>
<xsl:value-of select=”@ID“/><xsl:text
disable-output-escaping=”yes>&nbsp;&nbsp;</xsl:text>(<xsl:value-of select=”@Status“/>)
</legend>
<br/>
<ul>
<xsl:apply-templates select=”Portfolios/Portfolio“/>
</ul>

</fieldset>
<br/>
</xsl:template>

<xsl:template match=”Portfolio>
<li style=”vertical-align: middle;>

<div style=”padding-left: 5px;padding-right: 8px;font-size: x-small;>

<fieldset style=”margin-top: 5px;margin-bottom: 6px;>
<legend>
<xsl:value-of select=”@ID“/><xsl:text
disable-output-escaping=”yes>&nbsp;&nbsp;</xsl:text>(<xsl:value-of select=”@Status“/>)
</legend>
<xsl:apply-templates select=”Reports/Report“/>
</fieldset>
</div>

</li>

</xsl:template>
<xsl:template match=”Report>

<xsl:call-template name=”links>
<xsl:with-param name=”strselect=”@Directory“/>
</xsl:call-template>
<xsl:value-of select=”.“/>

</xsl:template>

<xsl:template name=”links>
<xsl:param name=”str“/>
<xsl:if test=”string-length($str)>‘0’”>
<a href=”file:///{$str}>View</a>
<xsl:text
disable-output-escaping=”yes>&nbsp;&nbsp;</xsl:text>
</xsl:if>
</xsl:template>

</xsl:stylesheet>

Share