#32289 [Opn->Bgs]: Wrong handling of default namespaces
| From: | rrichards@php.net | Date: | Mon, 14 Mar 2005 12:28:28 +0000 |
| Subject: | #32289 [Opn->Bgs]: Wrong handling of default namespaces | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75310@lists.php.net to get a copy of this message | ||
ID: 32289
Updated by: rrichards@php.net
Reported By: daritter at rttr dot de
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: Linux (Debian/Sid)
PHP Version: 5.0.3
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Even if you think it is not a bug, we often know better than you,
please consult the support channels first before even considering
to reopen this report.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-03-13 12:08:15] daritter at rttr dot de
Description:
------------
When generating childs of an element with a default namespace using
DOMDocument->createElement() the namespace of the childs won't be set
to the correct value.
Reloading the DOMDocument using saveXML() and loadXML() fixes the
Problem.
Reproduce code:
---------------
$xml = new DOMDocument("1.0","UTF-8");
$foo = $xml->createElementNS('urn:foo','foo');
$xml->appendChild($foo);
$bar = $xml->createELement('bar','Bar using default namespace');
$foo->appendChild($bar);
/* results in
<foo xmlns="urn:foo"><bar>Bar using default namespace</bar></foo>
*/
$xsl = DOMDocument::Load('test.xsl');
$xslt = new xsltProcessor();
$xslt->importStylesheet($xsl);
print($xslt->transformToXML($xml));
print("\n\nReload DOM\n");
$xml = DOMDocument::LoadXML($xml->saveXML());
print($xslt->transformToXML($xml));
-----------test.xsl-------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:foo="urn:foo"
>
<xsl:output method="text" omit-xml-declaration = "yes"/>
<xsl:template match="foo:foo">
foo:bars:<xsl:apply-templates select="foo:bar"/>
bars:<xsl:apply-templates select="bar"/>
</xsl:template>
<xsl:template match="*">
- <xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Expected result:
----------------
foo:bars:
- Bar using default namespace
bars:
Reload DOM
foo:bars:
- Bar using default namespace
bars:
Actual result:
--------------
foo:bars:
bars:
- Bar using default namespace
Reload DOM
foo:bars:
- Bar using default namespace
bars:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32289&edit=1