2016-05-31 42 views
0

我想下面的節點XPath的格式屬性

<forecast-period index="1" start-time-local="2016-04-25T00:00:00+10:00" end-time-local="2016-04-26T00:00:00+10:00" start-time-utc="2016-04-24T14:00:00Z" end-time-utc="2016-04-25T14:00:00Z"> 

格式化爲遵循「週二4月26日」

到目前爲止,我有以下的日期,但不能似乎得到它工作

乾杯

<xsl:value-of select="format-date(document('IDN11050.xml')//area[@description='Sydney']/forecast-period[@index='1']/@start-time-local, '*not sure what to put here* ')"/> 

回答

1

你的問題缺乏上下文。如果你是在forecast-period元素的情況下,你可以使用:

<xsl:value-of select="format-dateTime(@start-time-local, '[F], [D] [MNn]')" /> 

返回:

Monday, 25 April 
+0

你是什麼意思的情況下缺乏?對不起,我不熟悉xpath。 commar應該在那裏? – seus

+0

逗號是可選的(星期一後輸出逗號)。什麼是錯誤信息? –

+0

我使用的是Mozilla Firefox(即一個newbee到xml/xsl/xpath)。它只是說錯誤加載樣式表:無效的XSLT/XPath函數。 – seus