<xsl:apply-templates> | |
適切なテンプレートをノードセットに適用するように XSLT プロセッサに指示します。 | |
カテゴリ | |
命令 |
|
必須の属性 | |
なし。 |
|
省略可能な属性 | |
|
|
コンテンツ | |
<xsl:apply-templates> 要素は、任意の数の <xsl:sort> および <xsl:with-param> 要素を含むことができます。ほとんどの場合、<xsl:apply-templates> は空です。 |
|
指定先 | |
<xsl:apply-templates> はテンプレート内に指定します。 |
|
定義先 | |
XSLT 5.4 節「Applying Template Rules」 |
|
例 | |
ケーススタディ (第 9 章 を参照) では、同じデータからいくつかの異なる出力を作成する必要がありました。これには、<xsl:apply-templates> 要素の mode 属性を使用して対応しました。メインテンプレート (match="/") を次に示します。 <xsl:template match="/"> <xsl:apply-templates select="tutorial" mode="build-main-index"/> <redirect:write select="concat($curDir, $fileSep, 'index.html')"> <xsl:apply-templates select="tutorial" mode="build-main-index"/> </redirect:write> <xsl:apply-templates select="tutorial" mode="build-section-indexes"/> <xsl:apply-templates select="tutorial" mode="build-individual-panels"/> <xsl:apply-templates select="tutorial" mode="generate-graphics"/> <xsl:apply-templates select="tutorial" mode="generate-pdf-file"> <xsl:with-param name="page-size" select="'ltr'"/> </xsl:apply-templates> <xsl:apply-templates select="tutorial" mode="generate-pdf-file"> <xsl:with-param name="page-size" select="'a4'"/> </xsl:apply-templates> <xsl:apply-templates select="tutorial" mode="generate-zip-file"/> </xsl:template> この例では、<tutorial> 要素を 8 回選択していますが、毎回別のモード (または同じモードに対して異なるパラメータ) でテンプレートを適用します。 |