XSLTProcessor->hasExsltSupport()

(no version information, might be only in CVS)

XSLTProcessor->hasExsltSupport() -- Determine if PHP has EXSLT support

说明

class XSLTProcessor {

bool hasExsltSupport ( void )

}

This method determine if PHP was built with the EXSLT library.

返回值

如果成功则返回 TRUE,失败则返回 FALSE

范例

例子 1. Testing EXSLT support

<?php

$proc
= new XSLTProcessor;
if (!
$proc->hasExsltSupport()) {
    die(
'EXSLT support not available');
}

// do EXSLT stuff here ..

?>


add a note add a note User Contributed Notes
bgarrett at jrcorps dot com
31-Mar-2005 03:29
I was scratching my head for hours on this one...

I had written a niftly little xsl-based form library a while back that worked great in PHP 4's less strict sablotron processor. The library was making use of some Result-Tree Fragments that, when I switched to PHP 5, resulted in some crazy output.

I was doing a bit more reading on Result-Tree Fragments in XSL and decided I needed to use something to turn the fragment into a node-set.

So, I was trying to use exslt's node-set() function as part of the exsl/common namespace. The phpinfo() and xsl-xsltprocessor::has-exslt-support() said I had EXSLT support.

However, when I used the examples on the exslt site I was getting the error:

"Warning: xmlXPathCompOpEval: function node-set not found in ./libraries/functions/xml_functions.php on line 24

Warning: Unregistered function in ./libraries/functions/xml_functions.php on line 24"

I google the errors, but only found some msxsl related mailing list articles. There was nothing relating to PHP or libxslt specifically.

I then searched on the libxslt site and found an example of someone using the "exslt" namespace vs the "exsl" namespace  as used on the EXSLT's documentation.

Sure enough, I changed the namespace, and it worked slick.

The moral of the story is that PHP's support for EXSLT's common lib has the "exslt" namespace and that this bug doesn't seem to get any notice from Google. This is why I am being verbose in hopes google will pick this comment up as to help other getting this error.

Links:
EXSLT's page for the exsl:node-set() function
http://exslt.org/exsl/functions/node-set/index.html

Example on libxsl's mailing list:
http://mail.gnome.org/archives/xslt/2001-October/msg00063.html

--
Blaine Flynn Garrett
Chief Web Applications Developer
http://jrcorps.com JR Computer Associates INC