Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Generating HTML from XSLT using <xsl:copy> (http://www.velocityreviews.com/forums/t491569-generating-html-from-xslt-using-xsl-copy.html)

Andy Dingley 03-27-2007 10:41 AM

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></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" (<br>) or "as XML" (<br /
>) ?


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


Bjoern Hoehrmann 03-27-2007 10:51 AM

Re: Generating HTML from XSLT using <xsl:copy>
 
* 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:bjoern@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/

Andy Dingley 03-27-2007 02:16 PM

Re: Generating HTML from XSLT using <xsl:copy>
 
On 27 Mar, 11:51, Bjoern Hoehrmann <bjo...@hoehrmann.de> wrote:

> 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.


Martin Honnen 03-27-2007 02:45 PM

Re: Generating HTML from XSLT using <xsl:copy>
 
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/


All times are GMT. The time now is 08:05 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.