Re: Space at start of result.

Subject: Re: Space at start of result.
From: Jeni Tennison <Jeni.Tennison@xxxxxxxxxxxxxxxx>
Date: Tue, 20 Jun 2000 18:59:20 +0100

>I am writing a servlet that processes an XML file, and returns HTML to the
>browser (Started with sample SaxonServlet).
>However, the servlet is inserting a blank line at the start of the result

I don't think that there's anything that says that HTML cannot have a blank
line at the start, and IE5 at least does seem to display the HTML fine with
one.  The best solution would probably be to have your users upgrade their
version of IE, but I guess that may not be feasible.

As far as why is concerned, SAXON puts a blank line at the beginning of its
output when it does not output an XML Declaration.  It doesn't output an
XML Declaration if the output method if HTML.  The output method is HTML if
it is either set by the 'method' attribute on xsl:output or if the document
element of the output is an 'html' element.

As far as a workaround is concerned, if you want to get rid of the blank
line you can make it output an XML Declaration by setting the output method
to 'xml' using the 'method' attribute of the xsl:output element, thusly:

  <xsl:output method="xml" />

As long as the extension for the output file is .html, the file will still
be interpreted as HTML by IE5, though I'm not sure for Netscape and
obviously the earlier versions of IE might react even worse to an XML
declaration than they do to a blank line!

The other thing would be to ask Mike Kay to change SAXON so that it doesn't
output the blank line, I guess.

Sorry not to be of more help,


Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 ? Fax 0115 9061304 ? Email

 XSL-List info and archive:

Current Thread