XSLTProcessor->registerPHPFunctions()
    (no version information, might be only in CVS)
XSLTProcessor->registerPHPFunctions() -- PHP 関数を XSLT 関数として利用できるようにする
説明
class 
XSLTProcessor { 
void 
registerPHPFunctions ( [mixed restrict] )
}
   このメソッドは、PHP 関数を XSL スタイルシートでの XSLT
   関数として利用できるようにします。
  
パラメータ
   
- restrict
 
       このパラメータは、XSLT からコールされる信頼できる関数のみを許可します。
      
       このパラメータには文字列 (関数名)
       あるいは関数の配列のいずれかを指定します。
      
 
  例
   
例 1. スタイルシートからの単純な PHP 関数コール 
<?php $xml = <<<EOB <allusers>  <user>   <uid>bob</uid>  </user>  <user>   <uid>joe</uid>  </user> </allusers> EOB; $xsl = <<<EOB <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"      xmlns:php="http://php.net/xsl"> <xsl:output method="html" encoding="utf-8" indent="yes"/>  <xsl:template match="allusers">   <html><body>     <h2>Users</h2>     <table>     <xsl:for-each select="user">       <tr><td>         <xsl:value-of              select="php:function('ucfirst',string(uid))"/>       </td></tr>     </xsl:for-each>     </table>   </body></html>  </xsl:template> </xsl:stylesheet> EOB; $xmldoc = DOMDocument::loadXML($xml); $xsldoc = DOMDocument::loadXML($xsl);
  $proc = new XSLTProcessor(); $proc->registerPHPFunctions(); $proc->importStyleSheet($xsldoc); echo $proc->transformToXML($xmldoc); ?>
 |  
  |