You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Georg Lundesgaard <gl...@enonic.com> on 2003/07/24 10:11:33 UTC

Always getting end-tags in HTML output.

Hi!

I want the output of empty elements in HTML to always have an end tag
like this:

<foo bar="zot"></foo>

and not like this:

<foo bar="zot"/>

I vaguely remember that there is an option for this, but i cannot find
it or remember where to look for it. Does anyone if it is possible and
how I can enforce it?

--
Georg Lundesgaard
Developer, Enonic AS - <URL:http://enonic.com> 
Mobile: +47 95 93 65 96, Office: +47 22 00 85 50, Fax: +47 22 00 85 51

Re: Always getting end-tags in HTML output.

Posted by Ivor Bosloper <i....@eccoo.rug.nl>.
Georg Lundesgaard wrote:
> I want the output of empty elements in HTML to always have an end tag
> like this:
> 
> <foo bar="zot"></foo>
> 
> and not like this:
> 
> <foo bar="zot"/>
> 
> I vaguely remember that there is an option for this, but i cannot find
> it or remember where to look for it. Does anyone if it is possible and
> how I can enforce it?

At first I thought

<xsl:output method="html"/>

would solve it. But it doesn't.


A few weeks ago Andrew Welch posted this solution on the list:

<quote>
The general solution to this is to output a space on each occurance of 
this, such as using &#160;, preferrably wrapped in a test:

<xsl:if test="not(child::node())">&#160;</xsl:if>

If you use xslt 2.0 you can use the xhtml output method, which solves 
all of this.
</quote>

Ivor