#31062 [Opn->Bgs]: Wrong XSLT with xmlns.
| From: | rrichards@php.net | Date: | Tue, 14 Dec 2004 16:13:31 +0000 |
| Subject: | #31062 [Opn->Bgs]: Wrong XSLT with xmlns. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70214@lists.php.net to get a copy of this message | ||
ID: 31062
Updated by: rrichards@php.net
Reported By: swappp at yandex dot ru
-Status: Open
+Status: Bogus
Bug Type: XSLT related
PHP Version: 5.0.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
non-namespace aware functions used
Previous Comments:
------------------------------------------------------------------------
[2004-12-12 00:34:23] swappp at yandex dot ru
Description:
------------
DOMDocument::load($xml_doc_node->saveXML());
It works normal...
Reproduce code:
---------------
$xml_doc_node = new DOMDocument('1.0', "UTF-8");
$xml_style =
$xml_doc_node->createProcessingInstruction('xml-stylesheet');
$xml_doc_node->appendChild($xml_style);
$xml_style->nodeValue = 'href="html.xsl" type="text/xsl"';
$xml_page = $xml_doc_node->createElement('document');
$xml_doc_node->appendChild($xml_page);
$element = $xml_page->appendChild(new DOMElement('old-html'));
$div = $element->appendChild(new DOMElement('div', 'test'));
$div->setAttribute('xmlns','http://www.w3.org/1999/xhtml');
$xsl = DOMDocument::loadXML('<?xml version="1.0"
encoding="UTF-8"?><xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:output doctype-public="-//W3C//DTD XHTML 1.0
Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
indent="yes" encoding="UTF-8"/>
<xsl:template match="/document">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="ru"
lang="ru"><body><xsl:apply-templates/></body></html>
</xsl:template>
<xsl:template match="/document/old-html"><xsl:copy-of
select="*"/></xsl:template>
</xsl:stylesheet>');
$proc = new xsltprocessor;
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml_doc_node);
Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="ru" lang="ru">
<body>
<div>test</div>
</body>
</html>
Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="ru" lang="ru">
<body>
<div xmlns="" xmlns="http://www.w3.org/1999/xhtml">test</div>
</body>
</html>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31062&edit=1