From: sfs at immune dot dk
Operating system: Windows XP SP2
PHP version: 5.0.4
PHP Bug Type: XSLT related
Bug description: XSLT Processor can't append element new xsl:include
Description:
------------
When using DOM to create a new <xsl:include> and insert it in the xslt
document php comes up with a error as seen below.
Reproduce code:
---------------
<?php
$xsl = new DOMDocument('1.0', 'UTF-8');
$test = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
EOF;
$xsl->loadXML($test);
$import = $xsl->createElement('xsl:import');
$import->setAttribute('href', 'login.xsl');
$xsl->documentElement->insertBefore($import,
$xsl->documentElement->firstChild);
echo $xsl->saveXML();
$html = new XSLTProcessor();
$html->importStylesheet($xsl);
?>
Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:import href="login.xsl"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
<br />
<b>Warning</b>: Found a top-level element xsl:import with null namespace
URI in <b>D:\steffen\frontend\test.php</b> on line <b>23</b><br />
Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:import href="login.xsl"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
--
Edit bug report at http://bugs.php.net/?id=34034&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34034&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34034&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34034&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34034&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34034&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34034&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34034&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34034&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34034&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34034&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34034&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34034&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34034&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34034&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34034&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34034&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34034&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34034&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34034&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34034&r=mysqlcfg