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 313890 - namespace collision with xsl:element and xsl:attribute
namespace collision with xsl:element and xsl:attribute
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: kbuchcik
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-08-18 20:32 UTC by Oleg Paraschenko
Modified: 2006-06-19 18:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Oleg Paraschenko 2005-08-18 20:32:10 UTC
Libxslt is confused when XSLT and XML use the same prefix with different
URI.

The following stylesheet adds attribute "y:foo" to each element, the
full name of the attribute is "{y:y:y}foo".

[code]
<x:stylesheet
  xmlns:x = "http://www.w3.org/1999/XSL/Transform"
  xmlns:y = "y:y:y"
  version = "1.0">
<!-- -->

<x:template match="node()|@*">
	<x:copy>
		<x:attribute name="y:foo">bar</x:attribute>
		<x:apply-templates select="node()|@*"/>
	</x:copy>
</x:template>

</x:stylesheet>
[/code]

Apply the stylesheet to the following XML.

[code]
<a xmlns:y="y2:y2:y2">
	<b y:white="white">
		<c y:black="black"/>
	</b>
</a>
[/code]

Result is the following.

[code]
<?xml version="1.0"?>
<a xmlns:y="y2:y2:y2" y:foo="bar">
        <b y:foo="bar" y:white="white">
                <c y:foo="bar" y:black="black"/>
        </b>
</a>
[/code]

The full name of the "foo" attribute is "{y2:y2:y2}foo", but should be
"{y:y:y}foo".

By the way, saxon generates the following:

[code]
<?xml version="1.0" encoding="utf-8"?>
<a xmlns:y="y2:y2:y2" xmlns:y.5="y:y:y" y.5:foo="bar">
        <b y.5:foo="bar" y:white="white">
                <c y.5:foo="bar" y:black="black"/>
        </b>
</a>
[/code]
Comment 1 Daniel Veillard 2005-08-19 07:52:04 UTC
Right that's a bug,

Daniel
Comment 2 kbuchcik 2006-06-19 18:25:33 UTC
Fixed in CVS HEAD.
Thanks for the report!

The following input:

<?xml version="1.0"?>
<a xmlns:y="y2:y2:y2">
	<b y:white="white">
		<c y:black="black">
      <d y:red="red"/>
    </c>
	</b>
</a>

Produces now this result:

<?xml version="1.0"?>
<a xmlns:y="y2:y2:y2" xmlns:y_1="y:y:y" y_1:foo="bar">
  <b xmlns:y="y:y:y" xmlns:y_2="y2:y2:y2" y:foo="bar" y_2:white="white">
    <c y:foo="bar" y_2:black="black">
      <d y:foo="bar" y_2:red="red"/>
    </c>
  </b>
</a>