ID:               24168
 Updated by:       [EMAIL PROTECTED]
 Reported By:      christian dot hang at web dot de
-Status:           Open
+Status:           Feedback
 Bug Type:         DOM XML related
 Operating System: Linux (Debian woody)
 PHP Version:      4.3.2
 New Comment:

Did you happen to change the libxslt/libxml versions the same time..?
You're not using the latest of them.




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

[2003-06-13 03:39:38] christian dot hang at web dot de

Description:
------------
After an upgrade (from 4.3.0 to 4.3.2), some of the XSL transformation
(handled by domxml) where not working correctly anymore.

It seems, that XSL functions (like concat) forget the current node,
that they should use to evualate relative XPath-Expression in their
arguments, when an absolute Path is given in a prior argument.

The example code demonstrates that behavior (compare description of
Expected result and Actual result). 

A quick workaround is the addition of the current()-function in the
relative path expressions, as that will fix the problem. But as far as
I know, that is not required by the standard.

If one switches the two arguments (concat(@nr, //testnode/@test)),
everything works fine, the current() is not necessary and @nr is
evaluated correctly. As the order of the arguments has an effect on the
path evaluation (which it should not), I figure that there is problem.

The versions of the libraries used:

DOM/XML API Version  20020815  
libxml Version  20419  
HTML Support  enabled  
XPath Support  enabled  
XPointer Support  enabled  
DOM/XSLT  enabled  
libxslt Version  1.0.20  
libxslt compiled against libxml Version  2.4.24  
DOM/EXSLT  enabled  
libexslt Version  1.0.20  

I have to admit that I cannot compare the library versions used here
with the ones I used for 4.3.0 version where everything worked okay
(system crashed - long and ugly story), so it might very well be a
problem of the libraries instead of the domxml extenstion.

Reproduce code:
---------------
$xml = "<?xml version=\"1.0\" ?><root><testnode
test=\"somevalue\"><node nr=\"1\"/><node nr=\"2\"/><node
nr=\"3\"/></testnode></roo\
t>";
$xml_doc = domxml_open_mem($xml);

$xsl_text="<?xml version=\"1.0\" ?>
<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\";
version=\"1.0\">
    <xsl:output method=\"xml\"/>
    <xsl:template match=\"root\">
        <new_root>
            <xsl:for-each select=\"testnode/node\">
                <xsl:value-of select=\"concat(//testnode/@test,
@nr)\"/> -
            </xsl:for-each>
        </new_root>
    </xsl:template>
</xsl:stylesheet>";

$xsl = domxml_open_mem($xsl_text);
$xsl_doc = domxml_xslt_stylesheet_doc($xsl);
$res = $xsl_doc->process($xml_doc);

Expected result:
----------------
A dump of the $res result tree should produce the following

<?xml version="1.0"?>
<new_root>somevalue1 - 
            somevalue2 - 
            somevalue3 - 
            </new_root>

and it does, if the concat expression in the example script is changed
to "concat(//testnode/@test, current()/@nr)"



Actual result:
--------------
A dump of the $res result tree does produce the following

<?xml version="1.0"?>
<new_root>somevalue - 
            somevalue - 
            somevalue - 
            </new_root>

The nr-attribute value is not concatenated to the value of the
test-attribute in testnode.



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


-- 
Edit this bug report at http://bugs.php.net/?id=24168&edit=1

Reply via email to