<: Con-param XSL> elemento XSLT
Definición y Uso
<Xsl: con-param> define los parámetros pasados a los valores de la plantilla.
Nota: <xsl: with-param> valor del atributo name del elemento debe ser <xsl: param> nombre del elemento contrario coincide ignorado <xsl: with-param>.
Nota: <xsl: apply-templates> y <xsl: call-template> tanto permite el uso de <xsl: with-param>.
Consejo: Usted puede <xsl: with-param> elemento o contenido a través de determinados atributos a la parametrización!
gramática
<xsl:with-param
name="name"
select="expression">
<!-- Content:template -->
</xsl:with-param>
name="name"
select="expression">
<!-- Content:template -->
</xsl:with-param>
propiedad
属性 | 值 | 描述 |
---|---|---|
name | name | 必需。规定参数的名称。 |
select | expression | 可选。定义参数的值的 XPath 表达式。 |
Ejemplo 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>
Completo manual de referencia del elemento XSLT