XSLT <xsl: param> element
Complete XSLT Element Reference Manual
Definition and Usage
<Xsl: param> element is used to declare local or global parameters.
Note: If, as a top-level element (top-level element) to declare that global parameters.If you declare the parameters in the template, that is, the local parameter.
grammar
<xsl:param
name="name"
select="expression">
<!-- Content:template -->
</xsl:param>
name="name"
select="expression">
<!-- Content:template -->
</xsl:param>
Attributes
属性 | 值 | 描述 |
---|---|---|
name | name | 必需。规定参数的名称。 |
select | expression | 可选。规定 XPath 表达式,该表达式是参数的默认值。 |
Example 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>
Complete XSLT Element Reference Manual