This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Control over html output
- To: "Andy Joslin" <andy at fifodigital dot com>
- Subject: Re: [xsl] Control over html output
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Sun, 20 May 2001 15:48:33 +0100
- CC: XSL-List at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <PHECKDNAJOHIFPDBBBOMOEMPCAAA.andy@fifodigital.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Andy,
> In this case the linebreak causes undesirable whitespace to appear
> in the resulting document in certain browsers. At the moment I'm
> having to rely on the rather crude solution of setting the html
> output indent to "no" to avoid this, but this seems a rather
> inelegant solution...
That's the most elegant solution you'll find :) By default,
processors indent HTML output, which means they can add whitespace to
make it easier to read. The indent attribute on xsl:output is
specifically designed to control that.
> On a similar note, is there any way to specify strict xhtml output?
> I've experimented with adding the xhtml doctype declaration but this
> hasn't really affected the output of the elements, e.g. <br/> in the
> stylesheet still gets output as <br> in spite of the doctype...
The rules for the html output method say that <br/> must be output as
<br> and so on. If you want well-formed XML output, such as XHTML,
then you should tell the processor that's what you want:
<xsl:output method="xml" />
You can then set the doctype-public and doctype-system as you know,
and use the XHTML namespace as appropriate.
However, you should be a little careful doing this. The XML
serialisers usually serialise in a way that breaks the HTML
compatibility guidelines in XHTML 1.0 (e.g. they output <br/> rather
than <br /> and use empty element for everything. Some processors
have a special extension XHTML output method to bring XHTML output
into line with the guidelines - I don't know if Xalan has.
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list