Hi,

I have a little problem transforming XML documents into HTML. I'm running
into
trouble as soon as my stylesheet contains HTML entities.

One simple example:

<!-- Stylesheet start -->

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd";>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" omit-xml-declaration="yes" encoding="ISO-8859-1"/>
  <xsl:template match='top'>
    <html>
      <body>
        Hello &nbsp; World!
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

<!-- Stylesheet end -->

My Java code that does the transformation:

<!-- start code -->

    TransformerFactory f = TransformerFactory.newInstance();
    Transformer t = f.newTransformer(new StreamSource(/* source XSL */)));
    StreamSource source = new StreamSource(/* XML source */);
    StreamResult result = new StreamResult(/* output stream */);
    t.transform(source, result);

<!-- end code -->

I'm using Xalan 2.5. Whenever I run my application, Xalan tries to load the
DTD
given in the DOCTYPE. Since I am on a slow network, this takes several
seconds. When I
am trying this without being connected to the Internet, transformation
fails, because
Xalan cannot contact www.w3.org.

Xalan obviously tries to resolve "&nbsp;", and therefore it needs to check
the DTD to
find out what "&nbsp;" means. Is there a way to disable this feature? I
really don't need
Xalan to resolve anything, since all entities will be interpreted by the
target Web browser.


I guess that this is quite a basic question, but I just can't find a
solution.

Thanks in advance for any help you can give me,

Volker

Reply via email to