为什么在xslt中不调用函数? [英] why function is not called in xslt?

查看:104
本文介绍了为什么在xslt中不调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调用function,但是没有显示出来.这是我的代码 https://plnkr.co/edit/TN1BN5Yao5Z63RDcBGlN?p=preview

I am trying to call function .But it not display out .here is my code https://plnkr.co/edit/TN1BN5Yao5Z63RDcBGlN?p=preview

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

   <xsl:template name="dosomething">
        <xsl:text>A function that does something</xsl:text>
    </xsl:template>

    <xsl:call-template name="dosomething"/>

</xsl:stylesheet>

推荐答案

xsl:call-template不能位于样式表的顶层.它只能在模板主体中使用,例如:

xsl:call-template cannot be at the top level of your stylesheet. It must only be used within a template body, for example:

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

   <xsl:template name="dosomething">
        <xsl:text>A function that does something</xsl:text>
    </xsl:template>

   <xsl:template match="/">
        <xsl:call-template name="dosomething"/>
    </xsl:template>


</xsl:stylesheet>

这篇关于为什么在xslt中不调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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