1 | <?xml version="1.0"?> |
---|
2 | <exslt:function xmlns:exslt="http://exslt.org/documentation" |
---|
3 | version="1" module="date" status="implemented"> |
---|
4 | |
---|
5 | <exslt:name>difference</exslt:name> |
---|
6 | |
---|
7 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
8 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
9 | ID="date:difference"> |
---|
10 | <dc:subject>EXSLT</dc:subject> |
---|
11 | <dc:subject>date</dc:subject> |
---|
12 | <dc:subject>difference</dc:subject> |
---|
13 | <exslt:revision> |
---|
14 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
15 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
16 | ID="date:difference.1"> |
---|
17 | <exslt:version>1</exslt:version> |
---|
18 | <dc:creator email="[email protected]" |
---|
19 | url="http://www.jenitennison.com/"> |
---|
20 | Jeni Tennison |
---|
21 | </dc:creator> |
---|
22 | <dc:date>2001-05-12</dc:date> |
---|
23 | <dc:description xmlns="http://www.w3.org/1999/xhtml"> |
---|
24 | Returns the difference between two dates as a duration. |
---|
25 | </dc:description> |
---|
26 | </rdf:Description> |
---|
27 | </exslt:revision> |
---|
28 | <exslt:revision> |
---|
29 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
30 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
31 | ID="date:difference.1.1"> |
---|
32 | <exslt:version>1.1</exslt:version> |
---|
33 | <dc:creator email="[email protected]" |
---|
34 | url="http://www.jenitennison.com/"> |
---|
35 | Jeni Tennison |
---|
36 | </dc:creator> |
---|
37 | <dc:date>2001-06-11</dc:date> |
---|
38 | <dc:description xmlns="http://www.w3.org/1999/xhtml"> |
---|
39 | Added implementations in Javascript, XSLT and EXSLT - Functions. |
---|
40 | </dc:description> |
---|
41 | </rdf:Description> |
---|
42 | </exslt:revision> |
---|
43 | <exslt:revision> |
---|
44 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
45 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
46 | ID="date:difference.1.2"> |
---|
47 | <exslt:version>1.2</exslt:version> |
---|
48 | <dc:creator email="[email protected]" |
---|
49 | url="http://www.jenitennison.com/"> |
---|
50 | Jeni Tennison |
---|
51 | </dc:creator> |
---|
52 | <dc:date>2001-06-16</dc:date> |
---|
53 | <dc:description xmlns="http://www.w3.org/1999/xhtml"> |
---|
54 | <ul> |
---|
55 | <li>Updated Javascript implementation.</li> |
---|
56 | <li>Added Microsoft-specific stylesheet.</li> |
---|
57 | </ul> |
---|
58 | </dc:description> |
---|
59 | </rdf:Description> |
---|
60 | </exslt:revision> |
---|
61 | <exslt:revision> |
---|
62 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
63 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
64 | ID="date:difference.1.3"> |
---|
65 | <exslt:version>1.3</exslt:version> |
---|
66 | <dc:creator email="[email protected]" |
---|
67 | url="">Craig Stewart</dc:creator> |
---|
68 | <dc:date>2002-08-21</dc:date> |
---|
69 | <dc:description xmlns="http://www.w3.org/1999/xhtml">Added 4XSLT and libxslt implementation to the list.</dc:description> |
---|
70 | </rdf:Description> |
---|
71 | </exslt:revision> |
---|
72 | <exslt:revision> |
---|
73 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
74 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
75 | ID="date:difference.1.4"> |
---|
76 | <exslt:version>1.4</exslt:version> |
---|
77 | <dc:creator email="[email protected]" |
---|
78 | url="">Craig Stewart</dc:creator> |
---|
79 | <dc:date>2002-11-12</dc:date> |
---|
80 | <dc:description xmlns="http://www.w3.org/1999/xhtml">Updated 4XSLT version to 0.12.0a3.</dc:description> |
---|
81 | </rdf:Description> |
---|
82 | </exslt:revision> |
---|
83 | </rdf:Description> |
---|
84 | |
---|
85 | <exslt:doc xmlns:html="http://www.w3.org/1999/xhtml" |
---|
86 | xmlns=""> |
---|
87 | <html:div xmlns="http://www.w3.org/1999/xhtml"> |
---|
88 | <p> |
---|
89 | The <code>date:difference</code> function returns the duration between the first date and the second date. If the first date occurs before the second date, then the result is a positive duration; if it occurs after the second date, the result is a negative duration. |
---|
90 | </p> |
---|
91 | <p> |
---|
92 | The two dates must both be right-truncated date/time strings in one of the formats defined in [<a href="http://www.w3.org/TR/xmlschema-2/" class="offsite">XML Schema Part 2: Datatypes</a>]. The date/time with the most specific format (i.e. the least truncation) is converted into the same format as the date with the most specific format (i.e. the most truncation). The permitted formats are as follows, from most specific to least specific: |
---|
93 | </p> |
---|
94 | <ul> |
---|
95 | <li> |
---|
96 | <a href="http://www.w3.org/TR/xmlschema-2/#dateTime" class="offsite"><code>xs:dateTime</code></a> (<code><var>CCYY</var>-<var>MM</var>-<var>DD</var>T<var>hh</var>:<var>mm</var>:<var>ss</var></code>) |
---|
97 | </li> |
---|
98 | <li> |
---|
99 | <a href="http://www.w3.org/TR/xmlschema-2/#date" class="offsite"><code>xs:date</code></a> (<code><var>CCYY</var>-<var>MM</var>-<var>DD</var></code>) |
---|
100 | </li> |
---|
101 | <li> |
---|
102 | <a href="http://www.w3.org/TR/xmlschema-2/#gYearMonth" class="offsite"><code>xs:gYearMonth</code></a> (<code><var>CCYY</var>-<var>MM</var></code>) |
---|
103 | </li> |
---|
104 | <li> |
---|
105 | <a href="http://www.w3.org/TR/xmlschema-2/#gYear" class="offsite"><code>xs:gYear</code></a> (<code><var>CCYY</var></code>) |
---|
106 | </li> |
---|
107 | </ul> |
---|
108 | <p> |
---|
109 | If either of the arguments is not in one of these formats, <code>date:difference</code> returns the empty string (<code>''</code>). |
---|
110 | </p> |
---|
111 | <p> |
---|
112 | The difference between the date/times is returned as a string in the format defined for <code>xs:duration</code> in [<a href="http://www.w3.org/TR/xmlschema-2/#duration" class="offsite">3.2.6 duration</a>] of [<a href="http://www.w3.org/TR/xmlschema-2/" class="offsite">XML Schema Part 2: Datatypes</a>]. |
---|
113 | </p> |
---|
114 | <p> |
---|
115 | If the date/time string with the least specific format is in either <code>xs:gYearMonth</code> or <code>xs:gYear</code> format, then the number of days, hours, minutes and seconds in the duration string must be equal to zero. (The format of the string will be <code>P<var>n</var>Y<var>n</var>M</code>.) The number of months specified in the duration must be less than 12. |
---|
116 | </p> |
---|
117 | <p> |
---|
118 | Otherwise, the number of years and months in the duration string must be equal to zero. (The format of the string will be <code>P<var>n</var>DT<var>n</var>H<var>n</var>M<var>n</var>S</code>.) The number of seconds specified in the duration string must be less than 60; the number of minutes must be less than 60; the number of hours must be less than 24. |
---|
119 | </p> |
---|
120 | </html:div> |
---|
121 | </exslt:doc> |
---|
122 | |
---|
123 | <exslt:definition xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
---|
124 | <exslt:return type="string" /> |
---|
125 | <exslt:arg name="start" type="string" |
---|
126 | optional="no" /> |
---|
127 | <exslt:arg name="end" type="string" |
---|
128 | optional="no" /> |
---|
129 | </exslt:definition> |
---|
130 | |
---|
131 | <exslt:implementations> |
---|
132 | <exslt:vendor-implementation |
---|
133 | version="1" |
---|
134 | vendor="4XSLT, from 4Suite." |
---|
135 | vendor-url="http://4Suite.org" |
---|
136 | vendor-version="0.12.0a3" /> |
---|
137 | <exslt:vendor-implementation |
---|
138 | version="1" |
---|
139 | vendor="libxslt from Daniel Veillard et al." |
---|
140 | vendor-url="http://xmlsoft.org/XSLT/" |
---|
141 | vendor-version="1.0.19" /> |
---|
142 | <exslt:implementation src="date.difference.function.xsl" language="exslt:exslt" |
---|
143 | version="1" /> |
---|
144 | <exslt:implementation src="date.difference.template.xsl" language="exslt:xslt" |
---|
145 | version="1" /> |
---|
146 | <exslt:implementation src="date.js" language="exslt:javascript" |
---|
147 | version="1"> |
---|
148 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
149 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
150 | ID="date:difference.js"> |
---|
151 | <dc:subject>EXSLT</dc:subject> |
---|
152 | <dc:subject>date</dc:subject> |
---|
153 | <dc:subject>difference</dc:subject> |
---|
154 | <dc:subject>Javascript</dc:subject> |
---|
155 | <exslt:revision> |
---|
156 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
157 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
158 | ID="date:difference.js.1"> |
---|
159 | <exslt:version>1</exslt:version> |
---|
160 | <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource"> |
---|
161 | <vcf:fn>Chris Bayes</vcf:fn> |
---|
162 | <vcf:email>[email protected]</vcf:email> |
---|
163 | <vcf:url>http://www.bayes.co.uk</vcf:url> |
---|
164 | </dc:creator> |
---|
165 | <dc:date>2001-06-11</dc:date> |
---|
166 | </rdf:Description> |
---|
167 | </exslt:revision> |
---|
168 | <exslt:revision> |
---|
169 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
170 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
171 | ID="date:difference.js.2"> |
---|
172 | <exslt:version>2</exslt:version> |
---|
173 | <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource"> |
---|
174 | <vcf:fn>Chris Bayes</vcf:fn> |
---|
175 | <vcf:email>[email protected]</vcf:email> |
---|
176 | <vcf:url>http://www.bayes.co.uk</vcf:url> |
---|
177 | </dc:creator> |
---|
178 | <dc:date>2001-06-16</dc:date> |
---|
179 | </rdf:Description> |
---|
180 | </exslt:revision> |
---|
181 | </rdf:Description> |
---|
182 | </exslt:implementation> |
---|
183 | <exslt:implementation src="date.msxsl.xsl" language="exslt:msxsl" |
---|
184 | version="1"> |
---|
185 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
186 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
187 | ID="date:difference.msxsl"> |
---|
188 | <dc:subject>EXSLT</dc:subject> |
---|
189 | <dc:subject>date</dc:subject> |
---|
190 | <dc:subject>difference</dc:subject> |
---|
191 | <dc:subject>MSXML</dc:subject> |
---|
192 | <exslt:revision> |
---|
193 | <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
194 | xmlns:dc="http://purl.org/dc/elements/1.1/" |
---|
195 | ID="date:difference.msxsl.1"> |
---|
196 | <exslt:version>1</exslt:version> |
---|
197 | <dc:creator xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" rdf:parseType="Resource"> |
---|
198 | <vcf:fn>Chris Bayes</vcf:fn> |
---|
199 | <vcf:email>[email protected]</vcf:email> |
---|
200 | <vcf:url>http://www.bayes.co.uk</vcf:url> |
---|
201 | </dc:creator> |
---|
202 | <dc:date>2001-06-16</dc:date> |
---|
203 | </rdf:Description> |
---|
204 | </exslt:revision> |
---|
205 | </rdf:Description> |
---|
206 | </exslt:implementation> |
---|
207 | </exslt:implementations> |
---|
208 | |
---|
209 | <exslt:use-cases /> |
---|
210 | |
---|
211 | </exslt:function> |
---|