After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 136914 - namespace in output tree with xsl:element when name specifies a non default namespace
namespace in output tree with xsl:element when name specifies a non default n...
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-03-11 17:58 UTC by stf
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description stf 2004-03-11 17:58:53 UTC
It appears that when using xsl:element with a non default namespace for the
name attribute the output element namespace is not computed as expected.

Here is a small example (mixing xul, xhtml, xsl) : 
1/ XML 
<?xml version="1.0"?>
<a>
hhhh
</a>

2/ XSL 
<?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.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:xhtml="http://www.w3.org/1999/xhtml"   >
   <xsl:output method="xml" indent="yes" encoding="iso-8859-1" />
   <xsl:template match="/">
      <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
      <windows>
        <vbox flex="1">
                   <xsl:apply-templates />
            </vbox>
      </windows>
   </xsl:template>
   <xsl:template match="a">
         <vbox>
                <xhtml:div>Hello</xhtml:div>
                <xsl:element name="xhtml:div">
                        foo
                </xsl:element>
         </vbox>
   </xsl:template>
</xsl:stylesheet>

xsltproc produces :
<?xml version="1.0" encoding="iso-8859-1"?>
<windows
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" x
mlns:xhtml="http://www.w3.org/1999/xhtml">
  <vbox flex="1">
    <vbox>
      <xhtml:div>Hello</xhtml:div>
      <xhtml:div
xmlns:xhtml="http://www.mozilla.org/keymaster/gatekeeper/there.
is.only.xul">
                        foo
                </xhtml:div>
    </vbox>
  </vbox>
</windows>

while sablotron, msxml produce the expected result :

<?xml version="1.0" encoding="iso-8859-1"?>
<windows xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <vbox flex="1">
    <vbox>
      <xhtml:div>Hello</xhtml:div>
      <xhtml:div>
                        foo
                </xhtml:div>
    </vbox>
  </vbox>
</windows>

Of course using an additionnal namespace="http://www.w3.org/1999/xhtml"
solves the problem. 

Stephane
Comment 1 William M. Brack 2004-03-12 05:04:40 UTC
I added some additional code which should fix this 
(libxslt/namespaces.c).  I also added your test case to the 
regression tests to assure future fixes will take account of it.  
Fixes are in CVS - thanks for the report.
Comment 2 Daniel Veillard 2004-03-25 11:41:51 UTC
This should be closed by release of libxslt-1.1.5,
                                                                                
  thanks,
                                                                                
Daniel