This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Variance between XSLT engines when outputting HTML with a namespace


Hip hei!

Say we have

<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns="http://www.w3.org/TR/REC-html40";>

<xsl:output method="html"
            indent="yes" 
            encoding="ISO-8859-1" />

<xsl:template match="/">
  <html>
    <head>
      <title/>
    </head>
    <body>
      <p>
        <br/>
      </p>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>

The "HTML 4.01 namespace" shouldn't be there as there are no namespaces in
SGML, but J. Clark used it in "Namespaces in XML" [1] and I've seen people
use it. Anyhow, the XSLT 1.0/1.1 says 

"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. If the expanded-name of the element has a null
namespace URI, but the local part of the expanded-name is not recognized as
the name of an HTML element, the element should output in the same way as a
non-empty, inline element such as span.

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>." [2]

Here's what the XSLT processors on my computer did:

                          output NS  omit end-tag
jd.xslt 1.1                 no          yes
XT 19991105                 yes         yes
Xalan-J 2.2.D10             yes         no
MSXML 3                     yes         no
SAXON 6.4.3                 yes         yes
Oracle-J 9.0.2.0.0A Beta    yes         yes

If I've interpreted the spec correctly, Xalan and MSXML are right. Right?

Jarno

[1] http://www.w3.org/TR/REC-xml-names/
[2] http://www.w3.org/TR/xslt#section-HTML-Output-Method

--
A Tank. Dead butch but a bugger to park. 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]