English 中文(简体)
说明按格式分列的零胎 时间
原标题:Specifying zero padding with format-dateTime

我有以下斜体:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:variable name="cDate">
        <xsl:value-of select="current-dateTime()"/>
    </xsl:variable>
    <xsl:variable name="fcDate">
        <xsl:value-of select="format-dateTime($cDate, [Y0001][M01][D01] )"/>
    </xsl:variable>
    <xsl:template match="/PublisherBooking">
        <dt>
            <xsl:attribute name="date"><xsl:value-of select="$fcDate"/></xsl:attribute>
        </dt>
    </xsl:template>
</xsl:stylesheet>

这使我获得产出(当日为2010年1月12日时):

<?xml version="1.0" encoding="UTF-8"?>
<dt date="2010112"/>

我的问题是,需要以下格式:

<?xml version="1.0" encoding="UTF-8"?>
<dt date="20100112"/>

因此,我如何在月和日实现零婚? 具体来说,格式图[Y0001][M01][D01]有误。

FYI,我正在使用XMLSLT发动机,该发动机的船舶有XMLSpy 2005年。

最佳回答

其实,它看上去的是我版本的XSpMLy(2005年,距牙齿长)的发动机。 同Saxon9.2的转变一样,结果也是必要的。

问题回答

暂无回答




相关问题
When test hanging in an infinite loop

I m tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here s the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> ...

quick xslt for-each question

Let s say I have an XML document that has this: <keywords> <keyword>test</keyword> <keyword>test2</keyword> <keyword>test3</keyword> <keyword>test4</...

XSLT Transform XML with Namespaces

I m trying to transform some XML into HTML using XSLT. Problem: I can t get it to work. Can someone tell me what I m doing wrong? XML: <ArrayOfBrokerage xmlns:i="http://www.w3.org/2001/...

XSLT output to HTML

In my XSLT file, I have the following: <input type="button" value= <xsl:value-of select="name">> It s an error as it violates XML rule. What I actually want is having a value from an ...

Mangling IDs and References to IDs in XML

I m trying to compose xml elements into each other, and the problem I am having is when there s the same IDs. Basically what I need to do is mangle all the IDs in an xml file, as well as the ...

Sharepoint 2007 Data view Webpart custom parameters

I m sort of new to the custom parameters that can be setup on a DataView Webpart. There are 6 options: - None - Control - Cookie - Form - QueryString - Server Variable I think that None, Cookie and ...

热门标签