# XSL Extension

- Thread: https://externals.io/message/9253
- Original archive: https://news-web.php.net/php.internals/9253
- Started by Kenneth Schwartz on 2004-04-16T10:15:50+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #9253 — Kenneth Schwartz — 2004-04-16T10:15:50+00:00

URL: https://externals.io/message/9253#9253

I'm documenting the new XSL extension and needed a little clarification
on the two XSL functions in the PHP namespace [function() and
functionString()].  In what case would either of these XSL functions be
called?  As I understand it php:function() only allows string parameters
to the handling PHP function whereas php:functionString() allows passing
element values to the function.

Examples:
<xsl:value-of select="php:function('date', 'r')"/>
Outputs the RFC formatted date (current date/time)

<xsl:value-of select="php:functionString('date', 'r', date)"/>
Outputs the RFC formatted date of the <date> element as the unix
timestamp

I just wanted to be sure of what I've gathered from testing and the
source that the usage of both functions is correct.  Any other
information would be appreciated.

Thanks,

Kenneth

---

## #9254 — Adam Maccabee Trachtenberg — 2004-04-16T13:58:08+00:00

URL: https://externals.io/message/9253#9254 · In reply to: #9253

> Examples:
> <xsl:value-of select="php:function('date', 'r')"/>
> Outputs the RFC formatted date (current date/time)
>
> <xsl:value-of select="php:functionString('date', 'r', date)"/>
> Outputs the RFC formatted date of the <date> element as the unix
> timestamp
>
> I just wanted to be sure of what I've gathered from testing and the
> source that the usage of both functions is correct.  Any other
> information would be appreciated.

Yes. This is correct. php:functionString() allows you to pass
arbitrary elements to a function. This can be a text node, (as in your
example above), or even an entire set of element nodes. For example:

<xsl:value-of select="php:functionString('myDate', //date")/>

myDate is some userland function that iterates through an array of
//date nodes using DOM, does something on them, and returns a
value. If I was more awake, I'd give you a better example, but you get
the picture.

-adam

-- 
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
