首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XSLT 2.0中的时间格式

XSLT 2.0中的时间格式
EN

Stack Overflow用户
提问于 2013-04-24 15:05:43
回答 1查看 5.3K关注 0票数 1

我使用的是XSLT2.0和Java( Saxon-HE )。Saxon-HE不支持xslt日期-时间格式。我有current-date()和current-time()函数,我需要以下格式的它们: time(17:31),date(03/06).Please it.Thanks帮助我并给出任何建议

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-24 17:18:49

请尝试以下转换:

代码语言:javascript
复制
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="text"/>
<xsl:template match="test">
    <xsl:variable name="currenttime" select="current-dateTime()" as="xs:dateTime"/> 
    <xsl:value-of select="format-dateTime($currenttime,'[H]')"/><xsl:text>:</xsl:text><xsl:value-of select="format-dateTime($currenttime,'[m]')"/>
    <xsl:text>&#10;</xsl:text>
        <xsl:value-of select="format-dateTime($currenttime,'[M]')"/><xsl:text>/</xsl:text><xsl:value-of select="format-dateTime($currenttime,'[D]')"/>
</xsl:template>
</xsl:stylesheet>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16185501

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档