Hi i am having the xml file as:
<order><Extension Properties><Date>2009-08-04T17:09:04.593+05:30</Date></Extension  Properties></Order>
and i want the output as
Generation Date 040809
I want to do this via xslt.Please help..!!
Hi i am having the xml file as:
<order><Extension Properties><Date>2009-08-04T17:09:04.593+05:30</Date></Extension  Properties></Order>
and i want the output as
Generation Date 040809
I want to do this via xslt.Please help..!!
<xsl:variable name="dateString" select="order/Extension/Date/> (or something along those lines)
<xsl:value-of select="substring($date,9,10)"><xsl:value-of select="substring($date,6,7)"><xsl:value-of select="substring($date,1,4)">
One way is to use the substring functions:
<xsl:variable name="d" select="/order/Extension/Date" />
Generation Date <xsl:value-of select="concat(
substring($d, 9, 2),
substring($d, 6, 2),
substring($d, 3, 2))"/>
Other answers might depend on the XSL engine you are using. For instance, if you are using MSXML, you can use the datetime extension functions:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ms="urn:schemas-microsoft-com:xslt">
    <xsl:output method="xml" />
    <xsl:template match="/">
     <xsl:template match="Date">
     <xsl:variable name="d" select="/order/Extension/Date" />
     Generation Date
     <xsl:value-of select="ms:format-date($d, 'ddMMyy')"/>
    </xsl:template>
</xsl:stylesheet>
Good luck!
Using this as a guide...
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <order>
      <xsl:element name="GenerationDate">
        <xsl:call-template name="FormatDate">
          <xsl:with-param name="DateTime" select="order/Extension/Date"/>
        </xsl:call-template>
      </xsl:element>
    </order>
  </xsl:template>
  <xsl:template name="FormatDate">
    <xsl:param name="DateTime" />
    <xsl:variable name="day">
      <xsl:value-of select="substring($DateTime,9,2)" />
    </xsl:variable>
    <xsl:variable name="month">
      <xsl:value-of select="substring($DateTime,6,2)" />
    </xsl:variable>
    <xsl:variable name="year">
      <xsl:value-of select="substring($DateTime,3,2)" />
    </xsl:variable>
    <xsl:value-of select="$day"/>
    <xsl:value-of select="$month"/>
    <xsl:value-of select="$year"/>
  </xsl:template>
</xsl:stylesheet>