本文介绍了如何在XSLT中更改Dateformate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我有下面的代码xslt.如何更改xslt中的日期格式??
现在它以"DD/MON/YY"格式返回.但是我希望以"DD/MM/YYYY"格式返回.
我尝试了注释部分中的代码...
参见下面的代码....
hello friends,
i have below code of xslt. how can i change the date formate in xslt.?
now it''s returning in "DD/MON/YY" formate.but i want it in "DD/MM/YYYY" formate.
i have tried code which is in commented part...
See the below code....
<xsl:element name="{$rowName}">
<xsl:for-each select="$fieldset[@name = $rowField]/s:AttributeType">
<xsl:variable name="fieldname" select="@name" />
<xsl:variable name="dataType" select="$fieldset[@name = $rowField]/s:AttributeType[@name=$fieldname]/s:datatype/@dt:type" />
<xsl:variable name="fieldvalue">
<xsl:choose>
<xsl:when test="$dataType = 'dateTime'">
<xsl:value-of select="substring($row/@*[name()=$fieldname], '1', '2')"/>
<!-- i have tried below code to get date in MM formate.. but... :( -->
<!--<xsl:variable name="mm">
<xsl:value-of select="substring($row/@*[name()=$fieldname],4,2)" />
</xsl:variable>
<xsl:value-of select="$mm"/> -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$row/@*[name()=$fieldname]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$fieldname}"><xsl:value-of select="$fieldvalue" /></xsl:element>
<!--xsl:attribute name="{$fieldname}"><xsl:value-of select="$fieldvalue" /></xsl:attribute-->
</xsl:for-each>
<!--RECURSIVELY CALL THIS TEMPLATE IF IT CONTAINS ANY CHILD ELEMENTS-->
<xsl:apply-templates select="*" />
</xsl:element>
预先感谢....
Thanx in advance....
推荐答案
这篇关于如何在XSLT中更改Dateformate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!