469,568 Members | 1,358 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

Generating HTML from XSLT using <xsl:copy>

>From a thread over in c.i.w.a.h
"RFC: From XHTML to HTML via XSLT"
http://groups.google.co.uk/group/com...12c230061ffe86
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></brin 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" (<br>) or "as XML" (<br /
>) ?
What do practical transform engines do here? Are they consistent?

Mar 27 '07 #1
3 2265
* 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 ?
Should the XSLT transfrom treat it "as HTML" (<br>) or "as XML" (<br /
>>) ?
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>.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Mar 27 '07 #2
On 27 Mar, 11:51, Bjoern Hoehrmann <bjo...@hoehrmann.dewrote:
Well, read the text right before what you quoted?
RTFM you mean? 8-)

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.

Mar 27 '07 #3
Andy Dingley wrote:
I'd always assumed that XHTML and the
standard XHTML namespace URI was treated as HTML.
With XSLT 2.0 there is an output method 'xhtml' which is supposed to
serialize XHTML so that it can be served as text/html, see
<http://www.w3.org/TR/xslt-xquery-serialization/#xhtml-output>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by inquirydog | last post: by
15 posts views Thread by Philipp Lenssen | last post: by
2 posts views Thread by Paul Verbelen | last post: by
3 posts views Thread by abhishek.smu | last post: by
2 posts views Thread by Nitin Walke | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.