Re: [xsl] XSLT for usable yet valid XHTML

Subject: Re: [xsl] XSLT for usable yet valid XHTML
From: Emmanouil Batsis <Emmanouil.Batsis@xxxxxxxxxxx>
Date: Wed, 06 Apr 2005 18:05:10 +0300
Jonah Gold wrote:

Hi -

First off, greetings as I am new to this list. I may not be sticking
around too long though, I should warn, as I may not be doing XSL dev
full-time too much longer. But so long as I'm here I have a question.

We are using XSLT 1.0, parsed by jd.xslt, to transform XML into XHTML.
For output we are currently using <xsl:output method="html" etc... >

The HTML output method will output non-well formed tags like <br>. You need to use the XML output method to produce XHTML.

This obviously doesn't produce valid xhtml - the slash is removed from
singleton tags, 'checked="checked"' is transformed to simply 'checked',
and some other similar things. This is not surprising, since our method
is set to "html", which defaults to html 4, but ideally we would like
this not to be the case - we are fairly interested in making our XHTML
as valid as possible.

So why, you ask, are we not using 'method="xml"'? This would solve the
above problems, true, but we've had problems with it because our content
is variable enough that we may have the situation of empty tags (i.e.
'<h3></h3>') being converted into singleton tags (i.e. <h3/>) by the

put some <xsl:text></xsl:text> between the tags you wish to come out as non-empty (i.e. with a start and end tag).



Current Thread