why function is not called in xslt?

2019-07-30 05:26发布

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>

1条回答
啃猪蹄的小仙女
2楼-- · 2019-07-30 06:16

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>
查看更多
登录 后发表回答