为什么在 xslt 中不调用函数?
why function is not called in xslt?
我正在尝试调用函数。但它没有显示出来。这是我的代码
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: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>
我正在尝试调用函数。但它没有显示出来。这是我的代码 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: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>