0

我已经实现了这个功能(模板):

<xsl:template name="insSepToFechaHost">
    <xsl:param name="fecha" />
    <xsl:param name="sep" />
    <xsl:variable name="anio" select="substring($fecha,1,4)" />
    <xsl:variable name="mes" select="substring($fecha,5,2)" />
    <xsl:variable name="dia" select="substring($fecha,7,2)" />
    <xsl:value-of select="concat($anio,$sep,$mes,$sep,$dia)"/>
</xsl:template>

我称之为...

<fechaOperacion>
<xsl:call-template name="insSepToFechaHost">
    <xsl:with-param name="fecha" select="$datOperacion/STDR2_FECOPE" />
    <xsl:with-param name="sep" select="-" />
</xsl:call-template>

函数很简单,接收的值是这样的'20130502',函数将返回'2013-05-02'、'2013/05/02'、'2013*05*02'等......(取决于'sep' 值)。但是,我不知道为什么它不起作用?...我注意到如果我将参数 'sep' 更改为常数,该函数可以工作..

<xsl:value-of select="concat($anio,'-',$mes,'-',$dia)"/>

你能给一些建议吗?

提前致谢

4

1 回答 1

1

目前,您实际上并没有传递一个常量字符串sep

尝试更改此行

<xsl:with-param name="sep" select="-" />

为此

<xsl:with-param name="sep" select="'-'" />
于 2013-05-03T15:24:47.020 回答