#41248 [Bgs]: DOMDocument / DOMNode parameters
| From: | ifland at gmail dot com | Date: | Tue, 01 May 2007 14:10:43 +0000 |
| Subject: | #41248 [Bgs]: DOMDocument / DOMNode parameters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112138@lists.php.net to get a copy of this message | ||
ID: 41248
User updated by: ifland at gmail dot com
Reported By: ifland at gmail dot com
Status: Bogus
Bug Type: XSLT related
Operating System: All
PHP Version: 5.2.1
New Comment:
After looking at the functions a little closer, yes, I think this is
actually a limitation of libxslt and not specifically PHP. (I was
thinking that xsltParseGlobalParam's second argument "cur" was pointing
to an external xmlNodePtr, but it's actually referring to the
<xsl:param/> element itself. And I didn't see any way to pass in
DOMNodes or DOMDocuments into the transformation functions you sent.)
Thanks for looking at it.
Previous Comments:
------------------------------------------------------------------------
[2007-05-01 07:32:33] chregu@php.net
To me, it looks like libxslt doesn't suppport that and I can't see, how
your link helps for that :)
We use http://xmlsoft.org/XSLT/html/libxslt-
transform.html#xsltApplyStylesheetUser for the transformation and that
only accepts chars.
But maybe I missed some functions...
------------------------------------------------------------------------
[2007-05-01 03:58:07] ifland at gmail dot com
Description:
------------
As far as I can tell, the setParameter() function
(http://php.net/xsl_xsltprocessor_set_parameter) doesn't support passing
DOMDocument objects or DOMNode objects as parameters.
I was hoping to get it to work like it does in the .NET 2.0 framework.
(See
http://msdn2.microsoft.com/en-us/library/system.xml.xsl.xsltargumentlist.addparam.aspx)
But after looking at the PHP 5.2.1 source code,
/php-5.2.1/ext/xsl/xsltprocessor.c line 604-650, it appears that it's
not possible to do so in PHP even though it appears that libxslt
supports it (see
http://xmlsoft.org/XSLT/html/libxslt-variables.html#xsltParseGlobalParam)
Reproduce code:
---------------
...
$xslt = new XSLTProcessor();
//load stylesheet
...
$param = new DOMDocument();
$param->loadXML('<params><param name="value" /></params>');
$xslt->setParameter('', 'PARAMS', $param);
...
//use the value like this in the XSL
<xsl:param name="PARAMS" />
...
<xsl:value-of select="$PARAMS/params/param/@name" />
<!-- should output 'value' -->
Expected result:
----------------
The function should take the whole XML blob that's passed in and make
it available to the XSL as a global parameter variable.
Actual result:
--------------
Just a misleading warning ("Wrong parameter count")
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41248&edit=1