XSLT <xsl:param>
❮完全なXSLT要素リファレンス
定義と使用法
<xsl:param>要素は、ローカルまたはグローバルパラメーターを宣言するために使用されます。
注:パラメーターは、最上位要素として宣言されている場合はグローバルであり、テンプレート内で宣言されている場合はローカルです。
構文
<xsl:param
name="name"
select="expression">
<!-- Content:template -->
</xsl:param>
属性
Attribute | Value | Description |
---|---|---|
name | name | Required. Specifies the name of the parameter |
select | expression | Optional. Specifies an XPath expression that specifies a default value for the parameter |
例1
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template
match="/">
<html>
<body>
<xsl:for-each
select="catalog/cd">
<xsl:call-template name="show_title">
<xsl:with-param name="title" select = "title" />
</xsl:call-template>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template name = "show_title" >
<xsl:param name = "title"
/>
<p>Title: <xsl:value-of select = "$title" /></p>
</xsl:template>
</xsl:stylesheet>
❮完全なXSLT要素リファレンス