通过模板(template)名调用模板
|
|
Attributes
必须. 有效的名称
Element Information
|
|
Unlimited |
|
Parent elements |
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements |
|
Child elements |
xsl:with-param |
Remarks
能够使用template 名来调用模板但是前提必须这个模板已经在<xsl:template> 标签中定义过了
如下:
<xsl:stylesheet xml="http://www.w3.org/XML/1998/namespace" xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
</xsl:template><body>
</html><xsl:for-each select="//book">
</body><b>
<xsl:value-of select="title"/>
-
<xsl:value-of select="price"/>
</b><xsl:call-template name="cheaper">
</xsl:for-each><xsl:with-param name="price" select="price"/>
</xsl:call-template><xsl:template name="cheaper">
</xsl:stylesheet><xsl:param name="price"/>
<ul>
</xsl:template><i>List of less expensive books...</i>
<xsl:for-each select="//book[price < $price]">
</ul><li>
</xsl:for-each><xsl:value-of select="title"/>
<xsl:value-of select="price"/>
</li><xsl:value-of select="price"/>
浙公网安备 33010602011771号