使用参数调用 xslt 模板 [英] call xslt template with parameter

查看:20
本文介绍了使用参数调用 xslt 模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 xslt:

  <xsl:template name="dumpDebugData">
    <xsl:param name="elementToDump" />
    <xsl:for-each select="$elementToDump/@*">
      <xsl:text>&#10;</xsl:text>    <!-- newline char -->
      <xsl:value-of select="name()" /> : <xsl:value-of select="." />
    </xsl:for-each>
  </xsl:template>

我想显示每个元素(如名称/值),我该如何调用这个模板?

i want to display every element (as in name/value), how do i call this template?

推荐答案

由于模板需要一个节点集,你必须这样做:

Since the template expects a node set, you must do:

<xsl:call-template name="dumpDebugData">
  <xsl:with-param name="elementToDump" select="some/xpath" />
</xsl:call-template>

这篇关于使用参数调用 xslt 模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆