如何在xslt中转换日期格式

如何在xslt中转换日期格式

本文介绍了如何在xslt中转换日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How to Convert date format in xslt

Hi,

How to convert date format in xslt. I have created application as shown below

I used xml :
--------------

<TRSummary>
    <TravellerRequest>
        <RequestDate>2015-01-06T17:51:01.67+05:30</RequestDate>
    </TravellerRequest>
</TRSummary>

My xslt file :
--------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="html"/>
    <xsl:template match="TRSummary">
        <xsl:value-of select="format-dateTime(TravellerRequest/RequestDate,'[M01]/[D01]/[Y0001]')"/>
    </xsl:template>
</xsl:stylesheet>


in html page getting error :
---------------------------------------

Exception Details: System.Xml.Xsl.XsltException: 'format-dateTime()' is an unknown XSLT function.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

I need output like this:
-----------------------
 01/06/2015

How to convert the above datetime format into mm/dd/yyyy.

plz guide me.

Thanks,
Ram...

推荐答案


这篇关于如何在xslt中转换日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 15:42