开发者

How to format date in XSLT 2.0

I need to display date like Wednesday, 5th May, 2011 I am trying

<xsl:value-of select="format-date(
                         current-date(),
       开发者_JS百科                  '[FNn,*-3], [D01] [MNn,*-3] [Y0001]',
                         'en',
                         '',
                         'US'
                      )" />

And another one i tried

<xsl:value-of select="format-date(
                         current-date(),
                         '[FNn], [MNn] [D1o], [Y]',
                         'en',
                         (),
                         ()
                      )" />

Both gives me following. I need text and it gives number only. I use XSLT 2.0

3, 5 4, 2011


This stylesheet:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:value-of select="format-date(
                                 current-date(),
                                 '[FNn], [D1o] [MNn,*-3], [Y]',
                                 'en',
                                 (),
                                 ()
                              )" />
    </xsl:template>
</xsl:stylesheet>

Output:

Wednesday, 4th May, 2011

Tested on Saxon and Altova.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜