无法从您发布的内容中重现问题,主要是因为您引用的模板需要其他模板。
在任何情况下,如果您只需要生成两种不同格式的日期,您可以通过以下方式更简单地做到这一点:
<xsl:template name="formatDate">
<xsl:param name="day"/>
<xsl:param name="month"/>
<xsl:param name="year"/>
<xsl:param name="format" />
<xsl:choose>
<xsl:when test="$format='DMY'">
<xsl:value-of select="format-number($day, '00.')"/>
<xsl:value-of select="format-number($month, '00.')"/>
<xsl:value-of select="$year"/>
</xsl:when>
<xsl:when test="$format='MY'">
<xsl:value-of select="format-number($month, '00.')"/>
<xsl:value-of select="$year"/>
</xsl:when>
<xsl:otherwise>??</xsl:otherwise>
</xsl:choose>
</xsl:template>
调用模板的示例:
称呼:
<date>
<xsl:call-template name="formatDate">
<xsl:with-param name="format" select="'DMY'"/>
<xsl:with-param name="day" select="5"/>
<xsl:with-param name="month" select="3"/>
<xsl:with-param name="year" select="2014"/>
</xsl:call-template>
</date>
返回:
<date>05.03.2014</date>
称呼:
<date>
<xsl:call-template name="formatDate">
<xsl:with-param name="format" select="'MY'"/>
<xsl:with-param name="month" select="7"/>
<xsl:with-param name="year" select="1876"/>
</xsl:call-template>
</date>
返回:
<date>07.1876</date>