xsl:call-template是什么意思 ?

qozm 2003-08-19 10:16:13
请教xsl 的三个元素是什么意思?

1、用 xsl:call-template 调用模板,具体用法是什么?
2、xsl:param 和 xsl:set-param 的用法是什么?

最好结合实例讲解,或者提供讲解详细的网址!
...全文
1428 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2003-08-19
  • 打赏
  • 举报
回复
you can call or apply another template, see an example:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xsl_elm_qz_1f5g.asp

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- These 2 elements effectively assign
$messages = resources/en.xml/<messages>,
then $messages is used in the "localized-message" template. -->
<xsl:param name="lang">en</xsl:param>
<xsl:variable name="messages"
select="document(concat('resources/', $lang, '.xml'))/messages"/>

<xsl:template name="msg23" match="msg23">
<xsl:call-template name="localized-message">
<xsl:with-param name="msgcode">msg23</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template name="localized-message">
<xsl:param name="msgcode"/>
<!-- Show message string. -->
<xsl:message terminate="yes">
<xsl:value-of select="$messages/message[@name=$msgcode]"/>
</xsl:message>
</xsl:template>

</xsl:stylesheet>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧