Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to change the date format (dateFrom) in the following (Tag) xml.

*change by: dd/mm /yyyy

XML
<CancellationPolicies>
          <CancellationPolicy amount="355.500" dateFrom="20140613" time="2359" /></CancellationPolicies>




For that I use this xslt:
XML
What to add in the xslt?

<pre><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ms="urn:schemas-microsoft-com:xslt"
    xmlns:dt="urn:schemas-microsoft-com:datatypes"
    version="1.0">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="/">
        <xsl:apply-templates select="@*|node()"/>
    </xsl:template>
    <xsl:template match="ServiceHotel/AvailableRoom/HotelRoom/RoomType">
        Política de cancelación: Tipo Hab. <xsl:value-of select="@characteristic"/>  codigo:<xsl:value-of select="@code"/> 
    </xsl:template>
    
    <xsl:template match="//CancellationPolicies/CancellationPolicy">
       
       Si cancelas después de las <xsl:value-of select="@time"/> PM del  <xsl:value-of select="@dateFrom"/> se aplicaran unos gastos de:<xsl:value-of select="@amount"/>   <xsl:value-of select="//*/Currency/@code"/>
    </xsl:template>

  </xsl:stylesheet>




Thanks.
Posted
Updated 13-May-14 5:50am
v3

1 solution

XML
<xsl:template match="CancellationPolicy">
      <xsl:value-of select="concat(substring(@dateFrom, 7, 2), '/', substring(@dateFrom, 5, 2), '/', substring(@dateFrom, 1, 4))"/>
</xsl:template>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900