XSLTProcessor::registerPHPFunctionsとは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > XSLTProcessor::registerPHPFunctionsの意味・解説 

XSLTProcessor::registerPHPFunctions

(No version information available, might be only in CVS)
XSLTProcessor::registerPHPFunctions — PHP 関数を XSLT 関数として利用できるようにする

説明

class XSLTProcessor {
void registerPHPFunctions ( [mixed restrict] )
} このメソッドは、PHP 関数を XSL スタイルシートでの XSLT 関数として利用できるようにします。

パラメータ

restrict
このパラメータは、XSLT からコールされる信頼できる関数のみを許可します。
このパラメータには文字列 (関数名) あるいは関数の配列のいずれかを指定します。

返り値

値を返しません。

例 2468. スタイルシートからの単純な 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);
?>


変更履歴

バージョン説明
5.1.0 restrict パラメータが追加されました。




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「XSLTProcessor::registerPHPFunctions」の関連用語

XSLTProcessor::registerPHPFunctionsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



XSLTProcessor::registerPHPFunctionsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2025 by the PHP Documentation Group.

©2025 GRAS Group, Inc.RSS