XSLTます。<xsl:param>要素
定義と使用法
ます。<xsl:param>要素は、ローカルまたはグローバルパラメータを宣言するために使用されます。
注:トップレベルの要素(トップレベルの要素)として、そのグローバルパラメータを宣言するために、場合。テンプレート内のパラメータを宣言した場合、それは、地元のパラメータです。
文法
<xsl:param
name="name"
select="expression">
<!-- Content:template -->
</xsl:param>
name="name"
select="expression">
<!-- Content:template -->
</xsl:param>
プロパティ
属性 | 值 | 描述 |
---|---|---|
name | name | 必需。规定参数的名称。 |
select | expression | 可选。规定 XPath 表达式,该表达式是参数的默认值。 |
例1
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="xx">
<html>
<body>
<xsl:call-template name="show_title">
<xsl:with-param name="title" />
</xsl:call-template>
</body>
</html>
</xsl:variable>
<xsl:template name="show_title" match="/">
<xsl:param name="title" />
<xsl:for-each select="catalog/cd">
<p>Title: <xsl:value-of select="$title" /></p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="xx">
<html>
<body>
<xsl:call-template name="show_title">
<xsl:with-param name="title" />
</xsl:call-template>
</body>
</html>
</xsl:variable>
<xsl:template name="show_title" match="/">
<xsl:param name="title" />
<xsl:for-each select="catalog/cd">
<p>Title: <xsl:value-of select="$title" /></p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
完全なXSLT要素のリファレンス・マニュアル