Generating HTML from XSLT using <xsl:copy>

A

Andy Dingley

From a thread over in c.i.w.a.h
"RFC: From XHTML to HTML via XSLT"
http://groups.google.co.uk/group/comp.infosystems.www.authoring.html/msg/f112c230061ffe86


As is well-known, the XSLT HTML output method should generate <br>
rather than <br /> or <br></br>
From: <http://www.w3.org/TR/xslt#section-HTML-Output-Method>

:> The html output method should not output an end-tag for empty
elements. For HTML 4.0, the empty elements
:> are area, base, basefont, br, col, frame, hr, img, input,
isindex, link, meta and param. For example, an element
:> written as <br/> or <br></br> in the stylesheet should be output
as <br>.

So what happens if this "br" element is generated by an <xsl:copy>
from an XHTML input document, bound to the XHTML namespace URI ?
Should the XSLT transfrom treat it "as HTML" ( said:

What do practical transform engines do here? Are they consistent?
 
B

Bjoern Hoehrmann

* Andy Dingley wrote in comp.text.xml:
So what happens if this "br" element is generated by an <xsl:copy>
from an XHTML input document, bound to the XHTML namespace URI ?

Well, read the text right before what you quoted?

The html output method should not output an element differently from
the xml output method unless the expanded-name of the element has a
null namespace URI; an element whose expanded-name has a non-null
namespace URI should be output as XML.

Some time ago I wrote a quick and dirty XHTML-to-HTML XSLT document,
see <http://www.bjoernsworld.de/temp/xhtml-to-html4.xslt>.
 
A

Andy Dingley

Well, read the text right before what you quoted?

RTFM you mean? :cool:

The html output method should not output an element differently from
the xml output method unless the expanded-name of the element has a
null namespace URI;

Thanks! I'd never noticed that. I'd always assumed that XHTML and the
standard XHTML namespace URI was treated as HTML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top