View Single Post
  #2 (permalink)  
Old June 6th, 2008, 05:39 PM
philip_cole philip_cole is offline
Friend of Wrox
Points: 894, Level: 11
Points: 894, Level: 11 Points: 894, Level: 11 Points: 894, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: London, , United Kingdom.
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Hi,

I haven't done much with PHP XSL, but you can actually pass other arguments to the function other than the xsl bit.
The real problem with your code is that you can't pass arrays to the XSL functions, and the quotes are a right pain.

For the most part, you should be able to get round this by creating a simple global wrapper function which can call any other one. This can take the name of the global variable, the function name, and the argument[s]. At its most basic:

function CallGlobalFunction($objName, $funcName, $arg)
{
  return $GLOBALS[$objName]->$funcName($arg);
}

Your XSL can then call this when it needs an instance:

<xsl:value-of select="php:function('CallGlobalFunction', 'aSingleton', 'aNonStaticFunction', string(.))" />


Hope this Helps
Phil
Reply With Quote