[xslt] Possible bug in libxslt HTMl serialization

Im pretty sure this is a bug. It might be a problem with the HTML 
serialization. I've verifeid it on Linux with the latest 1.0.22 xsltproc 
and latest libxml. Saxon gives me the expected output. xsltproc does not.

Consider this stylesheet which is designed to transform XHTML into 
non-namespaced HTML:


  <xsl:output method="html"/>

   <xsl:template match="@*|node()">
       <xsl:apply-templates select="@*|node()"/>

   <xsl:template match="html:*">
     <xsl:element name="{name(.)}">
       <xsl:apply-templates select="@*|node()"/>


Apply this to the XHTML 1.0 spec with xsltproc:

% xsltproc xhtmltohtml.xsl http://www.w3.org/TR/xhtml1

Here's the beginning of the output:

<html lang="en" lang="en">

Notice the double lang attribute at the top. The second one has lost the 
xml: prefix. Saxon does remember the prefix and output separate lang and 
xml:lang attributes with the same stylesheet applied to the same input 

Changing the output method to xml does fix the problem; i.e. you get 
separate lang and xml:lang attributes.

Since the HTML output method isn't fully specified it's arguable that 
both xsltproc and Saxon are correct here. However, my gut is that the 
double lang attribute has to be considered a mistake, and that even in 
the html output method libxslt should be retaining the xml prefix.


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