XSLT 版本 2 中两个日期之间的日差。

Day difference between two dates in XSLT version 2.

有没有一种简单的方法可以让我获得 XSLT 中两个日期之间相差多少天。

您可以 subtract one xs:date from another one and then you get an xs:dayTimeDuration of which you can extract components e.g. xs:date('2015-06-11') - xs:date('2015-06-01') gives an xs:dayTimeDuration P10D and you can then call http://www.w3.org/TR/xquery-operators/#func-days-from-duration 例如days-from-duration(xs:date('2015-06-11') - xs:date('2015-06-01')) 给出 10.