当前位置: 首页 > 网络学院 > XML相关教程 > XSL/XSLT > XSLT <xsl:with-param> 元素

XSL/XSLT
XSL 语言
XSLT 介绍
XSLT 浏览器
XSLT 转换
<xsl:template>
<xsl:value-of>
<xsl:for-each>
<xsl:sort>
<xsl:if>
<xsl:choose>
<xsl:apply-templates>
XSLT - 客户端
XSLT - 服务器端
XSLT - 编辑XML
XSLT 摘要
XSLT 元素参考
XSLT 函数
XSL 编辑器

XSL/XSLT 中的 XSLT <xsl:with-param> 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 246 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The <xsl:with-param> element defines the value of a parameter to be passed into a template.
<xsl:with-param>元素的作用是:定义一个参数值,并将其传递到一个模版中。

Note: The value of the name attribute of <xsl:with-param> must match a name in an <xsl:param> element (the <xsl:with-param> element is ignored if there is no match).
注意:<xsl:with-param> 元素的 name 属性值必须与<xsl:param>元素内的其中一个名称相匹配(如果不存在匹配项,那么<xsl:with-param> 元素将被忽略)

Note: The <xsl:with-param> element is allowed within <xsl:apply-templates> and <xsl:call-template>.
注意:允许在<xsl:apply-templates> 元素和 <xsl:call-template>元素中定义<xsl:with-param>元素。

Tip: You can add a value to the parameter by the content of the <xsl:with-param> element OR by the select attribute!
提示:你可以通过 <xsl:with-param>元素或select 属性将一个值添加到元素中


Syntax
语法

<xsl:with-param
name="name"
select="expression">
 <!-- Content:template -->
</xsl:with-param>

Attributes
属性

属性 描述
name name Required. Specifies the name of the parameter
必要参数。指定参数名称
select expression Optional. An XPath expression that defines the value of the parameter
可选参数。指定一个用于定义参数值的XPath表达式

Example 1
案例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>

评论 (0) All

登陆 | 还没注册?