2017-06-21 5 views
2

Da ich das Datumsformat ändern kann, kommt der Wert von einem Xml sein Format ist "JJJJ-MM-TT" und ich möchte es in "TT-MM-JJJJ" ändern Ich verwende ein Version von xslt 1,0Xslt 1.0, ändere das Datumsformat

Dies ist 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>

Dies ist xslt

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

Antwort

1

können Sie substring() und concat() verwenden.

Beispiel ...

<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> 

Hinweis: Um eine Variable ist nicht erforderlich; Ich habe es nur benutzt, um den Concat einfacher zu lesen.

Verwandte Themen