From: daniel dot oconnor at gmail dot com
Operating system: Windows
PHP version: 5.2.5
PHP Bug Type: XSLT related
Bug description: XMLNS seem to be ignored for selecting attributes
Description:
------------
If an element + attribute are in a namespace, do both need to explicitly
referenced with said namespace?
Currently:
//example:[EMAIL PROTECTED] vs //example:[EMAIL PROTECTED]:sequence
Which is the correct behaviour? PHP currently chooses the first.
Reproduce code:
---------------
<?php
/* bug.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:example="http://example.com/">
<xsl:template match="example:Numbers">
I expect to see 54321 54321 One Two Three Four Five after this
point
<xsl:value-of select="@sequence" />
<xsl:value-of select="@example:sequence" />
<xsl:value-of select="." />
</xsl:template>
</xsl:stylesheet>
*/
/* bug.xml
<?xml version="1.0" encoding="utf-8"?>
<Example xmlns="http://example.com/" xmlns:ex="http://example.com">
<Numbers ex:sequence="54321" sequence="12345">One Two Three Four
Five</Numbers>
</Example>
*/
if (!extension_loaded('xsl')) {
die("Don't forget to enable to xsl extension");
}
$xml = new DOMDocument;
$xml->load(dirname(__FILE__) . '/bug.xml');
$xsl = new DOMDocument;
$xsl->load(dirname(__FILE__) . '/bug.xsl');
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
print $proc->transformToXML($xml);
?>
Expected result:
----------------
---------- php ----------
<?xml version="1.0"?>
I expect to see 54321 54321 One Two Three Four Five after this
point
5432154321One Two Three Four Five
Output completed (0 sec consumed) - Normal Termination
Actual result:
--------------
---------- php ----------
<?xml version="1.0"?>
I expect to see 54321 54321 One Two Three Four Five after this
point
12345One Two Three Four Five
Output completed (0 sec consumed) - Normal Termination
--
Edit bug report at http://bugs.php.net/?id=44140&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44140&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44140&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44140&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44140&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44140&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44140&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44140&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44140&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44140&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44140&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44140&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44140&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44140&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44140&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44140&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44140&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44140&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44140&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44140&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44140&r=mysqlcfg