CLXXX. XSL 関数

導入

XSL エクステンションは、XSL の標準規格を実装したもので、 libxslt ライブラリを用いて XSLT 変換 を行います。

要件

このテクステンションは http://xmlsoft.org/XSLT/ にある libxslt を使用します。 libxslt バージョン 1.1.0 以降が必要です。

インストール手順

PHP 5には、デフォルトでXSLエクステンションが含まれており、 configureに引数 --with-xsl[=DIR] を追加することにより有効にすることができます。 DIR は libxslt をインストールしたディレクトリです。

定義済みクラス

XSLTProcessor

コンストラクタ

メソッド

このリファレンスにある多くの例は、XML ファイルと XSL ファイルの両方を必要とします。 例では、以下の内容を含む collection.xml collection.xsl を使用します。

例 1. collection.xml

<collection>  <cd>   <title>Fight for your mind</title>   <artist>Ben Harper</artist>   <year>1995</year>  </cd>  <cd>   <title>Electric Ladyland</title>   <artist>Jimi Hendrix</artist>   <year>1997</year>  </cd> </collection>

例 2. collection.xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:param name="owner" select="'Nicolas Eliaszewicz'"/>  <xsl:output method="html" encoding="iso-8859-1" indent="no"/>  <xsl:template match="collection">   Hey! Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection!   <xsl:apply-templates/>  </xsl:template>  <xsl:template match="cd">   <h1><xsl:value-of select="title"/></h1>   <h2>by <xsl:value-of select="artist"/> - <xsl:value-of select="year"/></h2>   <hr />  </xsl:template> </xsl:stylesheet>

定義済み定数

以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。

XSL_CLONE_AUTO ( integer )

XSL_CLONE_NEVER ( integer )

XSL_CLONE_ALWAYS ( integer )

目次
XSLTProcessor::__construct  -- 新規 XSLTProcessor オブジェクトを生成する
XSLTProcessor::getParameter  -- パラメータの値を取得する
XSLTProcessor::hasExsltSupport  -- PHP が EXSLT をサポートしているかどうかを判定する
XSLTProcessor::importStylesheet  -- スタイルシートを取り込む
XSLTProcessor::registerPHPFunctions  -- PHP 関数を XSLT 関数として利用できるようにする
XSLTProcessor::removeParameter  -- パラメータを削除する
XSLTProcessor::setParameter  -- パラメータの値を設定する
XSLTProcessor::transformToDoc  -- DOMDocument に変換する
XSLTProcessor::transformToURI  -- URI に変換する
XSLTProcessor::transformToXML  -- XML に変換する