在xsl格式化日期 [英] format a date at xsl

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

问题描述

你好,
我有一个包含106本书的xml文件..

我将xsl转换为以下格式:

<xsl:value-of select=" bioghist/bioghist/chronlist/chronitem/date"/>

图书使用以下格式创建的日期:ddmmyyyy

如何添加斜线?并使其像dd/mm/yyyy ??

在此先感谢:)

Hello,
I have a xml file which has 106 books..

I xsl tranformed it and here:

<xsl:value-of select=" bioghist/bioghist/chronlist/chronitem/date"/>

there is the date that book has created with that format: ddmmyyyy

how can i add slashes? and make it like that dd/mm/yyyy ??

thanks in advance :)

推荐答案

我认为这应该为您服务:
I think this should do for you:
<xsl:value-of select="ms:format-date(., 'dd/MM/yyyy')"/>



有关如何使用它的详细信息,请参见此处:
MSDN:ms:format-date函数 [



For details of how to use it, look here:
MSDN: ms:format-date Function [^]


现在整个xsl都没有" t work ..

我替换了这个:
Now the whole xsl doesn''t work..

I replaced this:
<br />
<td><xsl:for-each select=" bioghist/bioghist/chronlist/chronitem/date"  /></td>



使用下面的代码..



with the code below..

<td><br />
    <xsl:for-each select=" bioghist/bioghist/chronlist/chronitem/date"  /><br />
    <xsl:value-of select="ms:format-date(., ''dd/MM/yyyy'')"/><br />
     </td>


这篇关于在xsl格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆