![]() |
1
3
将文本作为
XSL Transformations 11.6 Passing Parameters to Templates
参数使用
此示例为带参数的编号块定义命名模板,以控制编号的格式。
|
![]() |
2
1
可以将其他字符串数据作为参数传递: <xsl:with param name=“pneededtext”选择“'--123abc'”/> 在调用的模板中定义此参数: <xsl:param name=“pneededtext”as=“xs:string”>
或者,你可以定义
全球的
|
![]() |
3
1
> Since the parameter numbers are > undefined (the tables can have > different number of cells) i can't use > a standard parameters for the > templates and used delimited string. 实际上,情况并非如此。 下面是一个 <xsl:with-param/>,其主体是一个节点集,该节点集可以由不同调用上的不同数量的元素组成: <xsl:template match="/"> <xsl:variable name="vrtfTParams"> <p>xxx</p> <p>yyy</p> <p>zzz</p> </xsl:variable> <xsl:call-template name="makeTable"> <xsl:with-param name="pTParams" select="msxsl:node-set($vrtfTParams)/*"/> </xsl:call-template> </xsl:template> “maketable”模板可以如此简单: <xsl:template name="makeTable"> <xsl:param name="pTParams"/> <table> <tr> <xsl:for-each select="$pTParams"> <td> <xsl:value-of select="."/> </td> </xsl:for-each> </tr> </table> </xsl:template> msxsl:node-set()扩展函数可用于Microsoft xslt处理器。大多数其他处理器都支持exslt:node-set()扩展函数(Microsoft的.NET xslt处理器xslcompiledtransform也支持它)。 如果$vrtftparams的内容不是动态生成的(与本例中的情况一样),则不需要xxx:node-set()函数,因为可以这样传递<xsl:variable>的内容: <xsl:with-param name="pTParams" select="document('')/*/xsl:variable[name()=vrtfTParams)/*"/> 这里必须全局定义$vrtftparams(xsl:template/>的子级)。 在xslt 2.0(和xpath2.0)中,没有rtf类型,根本不需要xxx:node-set()扩展函数。 希望这有帮助。 干杯, 迪米特里诺瓦切夫 |
![]() |
Pjoern · 在XSLT中包装没有属性的节点组 7 年前 |
![]() |
user2093335 · XSLT:基于现有属性值替换属性值 7 年前 |
![]() |
Leth · 字符串串联functoid不将映射值返回到目标记录 7 年前 |
![]() |
shawn · XSLT 3.0在应用模板中使用变量进行动态选择? 7 年前 |
|
user9238790 · 将XML转换为数据帧 7 年前 |
![]() |
Vanessa · xsl:当两个节点相等时,显示第一个节点的子节点 7 年前 |
![]() |
Adi · 并行读取大型XSLT字符串 7 年前 |
![]() |
Brian Arthur · XSLT从另一个上下文获取信息 7 年前 |