XSLT <xsl: with-param>
Definicja i Wykorzystanie
<Xsl: with-param> element definiuje parametry przekazane do wartości szablonów.
Uwaga: <xsl: with-param> wartość atrybutu name elementu musi być <xsl: param> nazwa elementu mecze inaczej ignorowane <xsl: with-param> elementem.
Uwaga: <xsl: apply-templates> i <xsl: call-template> oba pozwalają na wykorzystanie <xsl: with-param> elementu.
Wskazówka: Można <xsl: with-param> elementu lub treści poprzez wybranych atrybutów do parametryzacji!
gramatyka
<xsl:with-param
name="name"
select="expression">
<!-- Content:template -->
</xsl:with-param>
name="name"
select="expression">
<!-- Content:template -->
</xsl:with-param>
nieruchomość
属性 | 值 | 描述 |
---|---|---|
name | name | 必需。规定参数的名称。 |
select | expression | 可选。定义参数的值的 XPath 表达式。 |
Przykład 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>
Kompletna instrukcja XSLT element odniesienia