0
XML收到轉換日期fromat在XML響應收到,而使用XSLT轉換
<ns15:ReferenceEffectiveDate>
<ns12:Year>2016</ns12:Year>
<ns12:Month>7</ns12:Month>
<ns12:Day>20</ns12:Day>
</ns15:ReferenceEffectiveDate>
.
.
.
.
.
.
.
.
<ns15:ReferenceEffectiveDate>
<ns12:Year>2016</ns12:Year>
<ns12:Month>7</ns12:Month>
<ns12:Day>20</ns12:Day>
</ns15:ReferenceEffectiveDate>
這是迄今爲止在從Web服務我的迴應XML收到的類型寫入文本文件。
當月和日爲單個數字時,我一直在接收日期格式爲YYYYMD。和YYYYMMDD當月和日是兩位數。
我想通過XSLT轉換獲得格式爲YYYYMMDD。
目前我使用
<xsl:template match="/">
<xsl:for-each select......(sometext which cannot be written)>
<xsl:value-of select="ns2:ReferenceEffectiveDate"/>
<xsl:value-of select="$line-separator"/>
</xsl:for-each>
</xsl:template>
請幫助我如何能得到固定的格式拉動。
電流輸出收到的樣子
2016630
2016630
2016630
2016630
2016630
2016630
2016630
所需的輸出是
20160630
20160630
20160630
20160630
20160630
它給出的輸出爲 NaNNaN NaNNaN NaNNaN NaNNaN – shamsul
這是可能的,因爲你沒有發佈[mcve],我不得不猜測一些部分。但原則是正確的 - 看到它在這裏工作:http://xsltransform.net/94AbWAz –