0

我正在使用下面的代码在 xslt 程序中显示当前日期。使用日期格式 yyyy-mm-dd 可以正常工作。但我需要 dd-mmm-yyyy 格式。请帮助我做到这一点。

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:cs="urn:cs"
>

          <xsl:value-of select="cs:datenow()"></xsl:value-of>
4

1 回答 1

0

您已将您的问题标记为 XSLT 2.0,因此我希望您只需使用current-date函数http://www.w3.org/TR/xpath-functions/#func-current-date获取当前日期并使用XSLT 2.0 函数format-date http://www.w3.org/TR/xslt20/#format-date。所以基本上format-date(current-date(), '[D01]-[MN,*-3]-[Y0001]')给出了一种格式,如11-JUL-2013. 根据您的需要(我不确定格式mmm代表什么,因为大多数日期格式化例程都定义了自己的模式)您需要调整 的“图片字符串”参数format-date,请参阅我链接到的文档。

于 2013-07-11T10:07:23.600 回答