Xslt 1.0,更改日期格式

时间:2017-06-21 16:53:55

标签: xml xslt xslt-1.0

由于我可以更改日期格式,该值来自xml,其格式为“yyyy-mm-dd”,我想将其更改为“dd-mm-yyyy”我使用的是xslt 1.0的版本

这是xml

<Valores>

  <Valor calificacion="1" fecha="2014-07-31" moneda="1" fechaPagoCuota="2014-06-10" diasMora="0" cuotasMora="0" cuota="4736000.0" disponible="-1" saldoMora="0.0" saldoActual="599999000.0" cuotasCanceladas="1" valorInicial="600000000.0" totalCuotas="1" periodicidad="4"
  />

</Valores>

这是Xslt

<td align="center" class="Estilo2">
  <xsl:value-of select="Valores/Valor/@fechaPagoCuota" />
</td>

1 个答案:

答案 0 :(得分:1)

您可以使用substring()concat()

示例...

<td align="center" class="Estilo2">
  <xsl:variable name="dt" select="Valores/Valor/@fechaPagoCuota"/>
  <xsl:value-of select="concat(
    substring($dt,9,2),'-',
    substring($dt,6,2),'-',
    substring($dt,1,4))" />
</td>

注意:不需要使用变量;我只用它来使concat更容易阅读。

相关问题