Re: [xslt] re: <br></br> empty elements



On Tue, May 20, 2003 at 05:17:56PM +0100, Peter Robins wrote:
> <?xml version="1.0"?>
>    <xsl:stylesheet version="1.0"
>        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>        xmlns="http://www.w3.org/TR/html4/strict";>
>      <xsl:output method="html"/>
>      <xsl:template match="/">
> 	<html>
>        <br/>
>        <br></br>
>        </html>
>      </xsl:template>
>    </xsl:stylesheet>
> 
> and you get 
> 
> <html 
> xmlns="http://www.w3.org/TR/html4/strict";><br></br><br></br></html>
> 
> Agreed, for my purposes, I can easily remove the namespace 
> declaration, but as the default output for method=html is 4.0, output 
> with and without namespace declaration should be identical, shouldn't 
> they?

  Either you want to save XHTML or you want to save HTML.
The rules are not the same. XHTML1 serialization rules are for
output="xml" and the proper DOCTYPE set-up , or you use 
output="html" and in that case the XML is generated in the normal
way any XML would, and this includes nodes with namespaces.
  <html>
  <html xmlns="http://www.w3.org/TR/html4/strict";>
are 2 totally different nodes in that case. The first one is an 
HTML and hence SGML node serialized for HTML4.01 targets. In the
second case it is an XML node with a namespace and the serialization
rules are the ones of XML in that context.
  So no "output with and without namespace declaration should be identical"
is just plain wrong !

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]