ID:               44140
 Updated by:       [EMAIL PROTECTED]
 Reported By:      daniel dot oconnor at gmail dot com
 Status:           Bogus
 Bug Type:         XSLT related
 Operating System: Windows
 PHP Version:      5.2.5
 New Comment:

you should choose the same namespaces....

<Example xmlns="http://example.com/"; xmlns:ex="http://example.com";>

missing slash :)

And even if it would still be wrong, it's still not a PHP issue, since

the whole XSLT transformation is done by libxslt.


Previous Comments:
------------------------------------------------------------------------

[2008-02-17 09:46:12] daniel dot oconnor at gmail dot com

> Attributes are never in the default namespace, they have always to be

declared specifically. See the XML Specs for details

So you mean it should have been '//example:[EMAIL PROTECTED]:sequence' ?
If so, then PHP is choosing the wrong behaviour.

------------------------------------------------------------------------

[2008-02-17 08:29:30] [EMAIL PROTECTED]

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

Attributes are never in the default namespace, they have always to be 
declared specifically. See the XML Specs for details

------------------------------------------------------------------------

[2008-02-17 05:52:19] daniel dot oconnor at gmail dot com

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 this bug report at http://bugs.php.net/?id=44140&edit=1

Reply via email to