在XSL中取得當前時間

2021-05-23 08:43:12 字數 852 閱讀 7416

在xsl 中怎麼顯示當前時間,可以使用微軟的xsl 命名空間定義(一種是url 命名空間命名法:xmlns:msxsl="http://www.w3.org/tr/wd-xsl" ,一種是urn 命名空間命名法: xmlns:msxsl="urn:schemas-microsoft-com:xslt" ),具體**如下,分別建立hello.xsl 檔案和hello.xml 檔案於同一目錄下,用ie 開啟hello.xml 即可看到執行結果。

注意:下面的hello.xsl 中實際使用了兩種xsl 命名空間,一種是微軟的 xmlns:msxsl="urn:schemas-microsoft-com:xslt" ,一種是w3 組織的 xmlns:xsl="http://www.w3.org/1999/xsl/transform" 。

hello.xsl:

hello.xml:

注意:上面的 xmlns:msxsl="urn:schemas-microsoft-com:xslt" 只能使用urn 這樣的命名方法,我嘗試使用xmlns:msxsl="http://www.w3.org/tr/wd-xsl" 執行結果會報錯:

使用 xsl 樣式表無法檢視 xml 輸入。請更正錯誤然後單擊 重新整理 按鈕,或以後重試。

命名空間 'http://www.mycompany.org/ns/function' 不包含任何函式。

另外要注意 msxsl:script 不能在xsl:template 內部使用,否則也會出現上面相同錯誤。

曾嘗試在xsl:template 內部使用

clock(); 這樣的寫法無法執行出正確結果。

JS 取得當前時間日期

var mydate new date mydate.getyear 獲取當前年份 2位 mydate.getfullyear 獲取完整的年份 4位,1970 mydate.getmonth 獲取當前月份 0 11,0代表1月 mydate.getdate 獲取當前日 1 31 mydate.get...

在JSF中取得當前行序號的方法

很多時候,在渲染乙個datatable的時候,要求table的第一行是序號 index 對於這種要求,很多jsf 實現沒有提供,那麼就需要我們自己提供了,方法是這樣的 在datatable上繫結乙個uidata物件,利用uidata物件的rowindex屬性,就可以得到當前行資料在列表中的位置了,不...

取得當前滑鼠的X,Y座標

為了讓滑鼠移到小圖上顯示大圖,我利用滑鼠事件新建了乙個層來顯示大圖.當然之前最好得到xy座標 取得當前滑鼠的x,y座標 function selfxy else if document.documentelement document.documentelement.scrolltop docume...