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 341870 - In scope ns of literal result elements are not always copied to the result
In scope ns of literal result elements are not always copied to the result
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
git master
Other All
: Normal minor
: ---
Assigned To: kbuchcik
libxml QA maintainers
: 538941 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-05-15 15:25 UTC by kbuchcik
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description kbuchcik 2006-05-15 15:25:36 UTC
In scope namespaces of literal result elements are not always copied
to the result.

XSLT 1.0 (7.1.1):
"The created element node will also have a copy of the namespace nodes
that were present on the element node in the stylesheet tree with
the exception of..."

The current implementation does not keep track of in-scope namespaces
of all literal result elements.

It seems that a fix for this was already tried: the "inheritedNs" field
on a xsltTemplate inserts namespace nodes which were declared
in the descendant-or-self axis of an xsl:template.
But this does not cover all the cases we need to consider.

In the following examples, the result element "bar" needs to have the
namespace "urn:test:foo" in scope.

Example A
---------
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
  xmlns:foo="urn:test:foo"> 
  <xsl:output indent="yes"/>

  <xsl:template match="/">
    <xsl:element name="foo">
      <bar/>
    </xsl:element>
  </xsl:template>     

</xsl:stylesheet>

Result of Libxslt (error):
<?xml version="1.0"?>
<foo>
  <bar/>
</foo>

Expected result:
<?xml version="1.0"?>
<foo>
  <bar xmlns:foo="urn:test:foo"/>
</foo>

Example B
---------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
  xmlns:foo="urn:test:foo"> 
  <xsl:output indent="yes"/>  
  
  <xsl:variable name="bar">
    <bar/>
  </xsl:variable>

  <xsl:template match="/">
    <xsl:copy-of select="$bar"/>
  </xsl:template>     

</xsl:stylesheet>

Result of Libxslt (error):
<?xml version="1.0"?>
<bar/>

Expected result:
<?xml version="1.0"?>
<bar xmlns:foo="urn:test:foo"/>
Comment 1 kbuchcik 2006-05-15 15:27:04 UTC
Correction: the text 
"descendant-or-self axis of an xsl:template"
should read:
"ancestor-or-self axis of an xsl:template"
Comment 2 Nick Wellnhofer 2013-08-05 10:51:54 UTC
*** Bug 538941 has been marked as a duplicate of this bug. ***
Comment 3 GNOME Infrastructure Team 2021-07-05 10:59:45 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxslt/-/issues/

Thank you for your understanding and your help.