|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41248 DOMDocument / DOMNode parameters
Submitted: 2007-05-01 03:58 UTC Modified: 2007-05-01 14:10 UTC
From: ifland at gmail dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.2.1 OS: All
Private report: No CVE-ID: None
 [2007-05-01 03:58 UTC] ifland at gmail dot com
As far as I can tell, the setParameter() function ( 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
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

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")


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-01 07:32 UTC]
To me, it looks like libxslt doesn't suppport that and I can't see, how 
your link helps for that :)

We use
transform.html#xsltApplyStylesheetUser for the transformation and that 
only accepts chars. 

But  maybe I missed some functions...
 [2007-05-01 14:10 UTC] ifland at gmail dot com
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.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Sep 25 14:03:44 2022 UTC