xq-lsp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/builtins/builtins-array.xq +160 -0
- package/builtins/builtins-fn.xq +1100 -0
- package/builtins/builtins-map.xq +86 -0
- package/builtins/builtins-math.xq +100 -0
- package/dist/analyzer.d.ts +14 -0
- package/dist/analyzer.js +363 -0
- package/dist/builtins.d.ts +2 -0
- package/dist/builtins.js +28 -0
- package/dist/completion.d.ts +9 -0
- package/dist/completion.js +152 -0
- package/dist/features.d.ts +8 -0
- package/dist/features.js +214 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +145 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +0 -0
- package/package.json +29 -0
- package/src/analyzer.ts +402 -0
- package/src/builtins.ts +33 -0
- package/src/completion.ts +179 -0
- package/src/features.ts +260 -0
- package/src/server.ts +165 -0
- package/src/types.ts +47 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,1100 @@
|
|
|
1
|
+
module namespace fn="http://www.w3.org/2005/xpath-functions";
|
|
2
|
+
|
|
3
|
+
(: ── Accessors ──────────────────────────────────────────────────────────────── :)
|
|
4
|
+
|
|
5
|
+
(:~ Returns the name of a node as a QName. :)
|
|
6
|
+
declare function fn:node-name() as xs:QName? external;
|
|
7
|
+
(:~ @param $arg The node whose name to return :)
|
|
8
|
+
declare function fn:node-name($arg as node()?) as xs:QName? external;
|
|
9
|
+
|
|
10
|
+
(:~ Returns true if the element has been nilled. :)
|
|
11
|
+
declare function fn:nilled() as xs:boolean? external;
|
|
12
|
+
(:~ @param $arg The node to test :)
|
|
13
|
+
declare function fn:nilled($arg as node()?) as xs:boolean? external;
|
|
14
|
+
|
|
15
|
+
(:~ Returns the string value of the context item. :)
|
|
16
|
+
declare function fn:string() as xs:string external;
|
|
17
|
+
(:~
|
|
18
|
+
: Returns the string value of an item.
|
|
19
|
+
: @param $arg The item to convert to string
|
|
20
|
+
: @return The string value
|
|
21
|
+
:)
|
|
22
|
+
declare function fn:string($arg as item()?) as xs:string external;
|
|
23
|
+
|
|
24
|
+
(:~ Atomizes the context item. :)
|
|
25
|
+
declare function fn:data() as xs:anyAtomicType* external;
|
|
26
|
+
(:~
|
|
27
|
+
: Atomizes a sequence, extracting typed values from nodes.
|
|
28
|
+
: @param $arg The sequence to atomize
|
|
29
|
+
: @return The atomized values
|
|
30
|
+
:)
|
|
31
|
+
declare function fn:data($arg as item()*) as xs:anyAtomicType* external;
|
|
32
|
+
|
|
33
|
+
(:~ Returns the base URI of the context node. :)
|
|
34
|
+
declare function fn:base-uri() as xs:anyURI? external;
|
|
35
|
+
(:~
|
|
36
|
+
: Returns the base URI of a node.
|
|
37
|
+
: @param $arg The node
|
|
38
|
+
: @return The base URI, or empty sequence if absent
|
|
39
|
+
:)
|
|
40
|
+
declare function fn:base-uri($arg as node()?) as xs:anyURI? external;
|
|
41
|
+
|
|
42
|
+
(:~ Returns the document URI of the context node. :)
|
|
43
|
+
declare function fn:document-uri() as xs:anyURI? external;
|
|
44
|
+
(:~
|
|
45
|
+
: Returns the document URI of a document node.
|
|
46
|
+
: @param $arg The document node
|
|
47
|
+
: @return The document URI, or empty sequence if absent
|
|
48
|
+
:)
|
|
49
|
+
declare function fn:document-uri($arg as node()?) as xs:anyURI? external;
|
|
50
|
+
|
|
51
|
+
(: ── Error and diagnostics ─────────────────────────────────────────────────── :)
|
|
52
|
+
|
|
53
|
+
(:~ Raises a dynamic error. :)
|
|
54
|
+
declare function fn:error() as empty-sequence() external;
|
|
55
|
+
(:~ @param $code Error code :)
|
|
56
|
+
declare function fn:error($code as xs:QName?) as empty-sequence() external;
|
|
57
|
+
(:~ @param $code Error code @param $description Error message :)
|
|
58
|
+
declare function fn:error($code as xs:QName?, $description as xs:string) as empty-sequence() external;
|
|
59
|
+
(:~ @param $code Error code @param $description Error message @param $error-object Additional error data :)
|
|
60
|
+
declare function fn:error($code as xs:QName?, $description as xs:string, $error-object as item()*) as empty-sequence() external;
|
|
61
|
+
|
|
62
|
+
(:~
|
|
63
|
+
: Returns the value of the first argument unchanged and emits a diagnostic trace message.
|
|
64
|
+
: @param $value The value to return unchanged
|
|
65
|
+
: @param $label A label for the trace output
|
|
66
|
+
: @return The input value
|
|
67
|
+
:)
|
|
68
|
+
declare function fn:trace($value as item()*, $label as xs:string) as item()* external;
|
|
69
|
+
|
|
70
|
+
(: ── Numeric functions ──────────────────────────────────────────────────────── :)
|
|
71
|
+
|
|
72
|
+
(:~
|
|
73
|
+
: Returns the absolute value of a number.
|
|
74
|
+
: @param $arg The number
|
|
75
|
+
: @return The absolute value
|
|
76
|
+
:)
|
|
77
|
+
declare function fn:abs($arg as xs:numeric?) as xs:numeric? external;
|
|
78
|
+
|
|
79
|
+
(:~
|
|
80
|
+
: Rounds a number up to the nearest integer.
|
|
81
|
+
: @param $arg The number to round up
|
|
82
|
+
: @return The smallest integer not less than $arg
|
|
83
|
+
:)
|
|
84
|
+
declare function fn:ceiling($arg as xs:numeric?) as xs:numeric? external;
|
|
85
|
+
|
|
86
|
+
(:~
|
|
87
|
+
: Rounds a number down to the nearest integer.
|
|
88
|
+
: @param $arg The number to round down
|
|
89
|
+
: @return The largest integer not greater than $arg
|
|
90
|
+
:)
|
|
91
|
+
declare function fn:floor($arg as xs:numeric?) as xs:numeric? external;
|
|
92
|
+
|
|
93
|
+
(:~
|
|
94
|
+
: Rounds a number to the nearest integer.
|
|
95
|
+
: @param $arg The number to round
|
|
96
|
+
: @return The nearest integer
|
|
97
|
+
:)
|
|
98
|
+
declare function fn:round($arg as xs:numeric?) as xs:numeric? external;
|
|
99
|
+
(:~
|
|
100
|
+
: Rounds a number to a specified precision.
|
|
101
|
+
: @param $arg The number to round
|
|
102
|
+
: @param $precision Number of decimal places
|
|
103
|
+
: @return The rounded number
|
|
104
|
+
:)
|
|
105
|
+
declare function fn:round($arg as xs:numeric?, $precision as xs:integer) as xs:numeric? external;
|
|
106
|
+
|
|
107
|
+
(:~
|
|
108
|
+
: Rounds to the nearest value, rounding halfway values to the nearest even number.
|
|
109
|
+
: @param $arg The number to round
|
|
110
|
+
: @return The rounded number
|
|
111
|
+
:)
|
|
112
|
+
declare function fn:round-half-to-even($arg as xs:numeric?) as xs:numeric? external;
|
|
113
|
+
(:~
|
|
114
|
+
: @param $arg The number to round
|
|
115
|
+
: @param $precision Number of decimal places
|
|
116
|
+
: @return The rounded number
|
|
117
|
+
:)
|
|
118
|
+
declare function fn:round-half-to-even($arg as xs:numeric?, $precision as xs:integer) as xs:numeric? external;
|
|
119
|
+
|
|
120
|
+
(:~
|
|
121
|
+
: Converts a value to xs:double.
|
|
122
|
+
: @param $arg The value to convert
|
|
123
|
+
: @return The value as xs:double, or NaN if not convertible
|
|
124
|
+
:)
|
|
125
|
+
declare function fn:number($arg as xs:anyAtomicType?) as xs:double external;
|
|
126
|
+
(:~ Returns the numeric value of the context item. :)
|
|
127
|
+
declare function fn:number() as xs:double external;
|
|
128
|
+
|
|
129
|
+
(:~
|
|
130
|
+
: Formats a number for display using a picture string.
|
|
131
|
+
: @param $value The number to format
|
|
132
|
+
: @param $picture The picture string
|
|
133
|
+
: @return The formatted string
|
|
134
|
+
:)
|
|
135
|
+
declare function fn:format-number($value as xs:numeric?, $picture as xs:string) as xs:string external;
|
|
136
|
+
(:~
|
|
137
|
+
: @param $value The number to format
|
|
138
|
+
: @param $picture The picture string
|
|
139
|
+
: @param $decimal-format-name Named decimal format to use
|
|
140
|
+
: @return The formatted string
|
|
141
|
+
:)
|
|
142
|
+
declare function fn:format-number($value as xs:numeric?, $picture as xs:string, $decimal-format-name as xs:string) as xs:string external;
|
|
143
|
+
|
|
144
|
+
(: ── String functions ───────────────────────────────────────────────────────── :)
|
|
145
|
+
|
|
146
|
+
(:~
|
|
147
|
+
: Constructs a string from a sequence of Unicode codepoints.
|
|
148
|
+
: @param $arg Sequence of codepoint integers
|
|
149
|
+
: @return The resulting string
|
|
150
|
+
:)
|
|
151
|
+
declare function fn:codepoints-to-string($arg as xs:integer*) as xs:string external;
|
|
152
|
+
|
|
153
|
+
(:~
|
|
154
|
+
: Returns the Unicode codepoints of a string.
|
|
155
|
+
: @param $arg The input string
|
|
156
|
+
: @return Sequence of codepoint integers
|
|
157
|
+
:)
|
|
158
|
+
declare function fn:string-to-codepoints($arg as xs:string?) as xs:integer* external;
|
|
159
|
+
|
|
160
|
+
(:~
|
|
161
|
+
: Compares two strings, returning -1, 0, or 1.
|
|
162
|
+
: @param $comparand1 First string
|
|
163
|
+
: @param $comparand2 Second string
|
|
164
|
+
: @return -1, 0, or 1
|
|
165
|
+
:)
|
|
166
|
+
declare function fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer? external;
|
|
167
|
+
(:~
|
|
168
|
+
: @param $comparand1 First string
|
|
169
|
+
: @param $comparand2 Second string
|
|
170
|
+
: @param $collation Collation URI
|
|
171
|
+
: @return -1, 0, or 1
|
|
172
|
+
:)
|
|
173
|
+
declare function fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer? external;
|
|
174
|
+
|
|
175
|
+
(:~
|
|
176
|
+
: Tests equality of two strings using Unicode codepoint comparison.
|
|
177
|
+
: @param $comparand1 First string
|
|
178
|
+
: @param $comparand2 Second string
|
|
179
|
+
: @return true if equal
|
|
180
|
+
:)
|
|
181
|
+
declare function fn:codepoint-equal($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean? external;
|
|
182
|
+
|
|
183
|
+
(:~
|
|
184
|
+
: Concatenates two or more strings. Accepts 2 or more arguments.
|
|
185
|
+
: @param $arg1 First string
|
|
186
|
+
: @param $arg2 Second string
|
|
187
|
+
: @return Concatenated string
|
|
188
|
+
:)
|
|
189
|
+
declare function fn:concat($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:string external;
|
|
190
|
+
|
|
191
|
+
(:~
|
|
192
|
+
: Joins a sequence of strings into one.
|
|
193
|
+
: @param $arg1 The strings to join
|
|
194
|
+
: @return The joined string
|
|
195
|
+
:)
|
|
196
|
+
declare function fn:string-join($arg1 as xs:anyAtomicType*) as xs:string external;
|
|
197
|
+
(:~
|
|
198
|
+
: Joins a sequence of strings using a separator.
|
|
199
|
+
: @param $arg1 The strings to join
|
|
200
|
+
: @param $arg2 The separator
|
|
201
|
+
: @return The joined string
|
|
202
|
+
:)
|
|
203
|
+
declare function fn:string-join($arg1 as xs:anyAtomicType*, $arg2 as xs:string) as xs:string external;
|
|
204
|
+
|
|
205
|
+
(:~
|
|
206
|
+
: Returns a substring starting at a position.
|
|
207
|
+
: @param $sourceString The source string
|
|
208
|
+
: @param $start 1-based starting position
|
|
209
|
+
: @return The substring
|
|
210
|
+
:)
|
|
211
|
+
declare function fn:substring($sourceString as xs:string?, $start as xs:double) as xs:string external;
|
|
212
|
+
(:~
|
|
213
|
+
: Returns a substring of specified length starting at a position.
|
|
214
|
+
: @param $sourceString The source string
|
|
215
|
+
: @param $start 1-based starting position
|
|
216
|
+
: @param $length Number of characters
|
|
217
|
+
: @return The substring
|
|
218
|
+
:)
|
|
219
|
+
declare function fn:substring($sourceString as xs:string?, $start as xs:double, $length as xs:double) as xs:string external;
|
|
220
|
+
|
|
221
|
+
(:~ Returns the length of the context item string value. :)
|
|
222
|
+
declare function fn:string-length() as xs:integer external;
|
|
223
|
+
(:~
|
|
224
|
+
: Returns the number of characters in a string.
|
|
225
|
+
: @param $arg The input string
|
|
226
|
+
: @return The character count
|
|
227
|
+
:)
|
|
228
|
+
declare function fn:string-length($arg as xs:string?) as xs:integer external;
|
|
229
|
+
|
|
230
|
+
(:~ Strips leading and trailing whitespace from the context item. :)
|
|
231
|
+
declare function fn:normalize-space() as xs:string external;
|
|
232
|
+
(:~
|
|
233
|
+
: Strips leading and trailing whitespace and collapses internal whitespace.
|
|
234
|
+
: @param $arg The input string
|
|
235
|
+
: @return The normalized string
|
|
236
|
+
:)
|
|
237
|
+
declare function fn:normalize-space($arg as xs:string?) as xs:string external;
|
|
238
|
+
|
|
239
|
+
(:~
|
|
240
|
+
: Applies Unicode normalization to a string.
|
|
241
|
+
: @param $arg The input string
|
|
242
|
+
: @return The normalized string (NFC form)
|
|
243
|
+
:)
|
|
244
|
+
declare function fn:normalize-unicode($arg as xs:string?) as xs:string external;
|
|
245
|
+
(:~
|
|
246
|
+
: @param $arg The input string
|
|
247
|
+
: @param $normalizationForm Normalization form: NFC, NFD, NFKC, NFKD, FULLY-NORMALIZED
|
|
248
|
+
: @return The normalized string
|
|
249
|
+
:)
|
|
250
|
+
declare function fn:normalize-unicode($arg as xs:string?, $normalizationForm as xs:string) as xs:string external;
|
|
251
|
+
|
|
252
|
+
(:~
|
|
253
|
+
: Converts a string to uppercase.
|
|
254
|
+
: @param $arg The input string
|
|
255
|
+
: @return Uppercased string
|
|
256
|
+
:)
|
|
257
|
+
declare function fn:upper-case($arg as xs:string?) as xs:string external;
|
|
258
|
+
|
|
259
|
+
(:~
|
|
260
|
+
: Converts a string to lowercase.
|
|
261
|
+
: @param $arg The input string
|
|
262
|
+
: @return Lowercased string
|
|
263
|
+
:)
|
|
264
|
+
declare function fn:lower-case($arg as xs:string?) as xs:string external;
|
|
265
|
+
|
|
266
|
+
(:~
|
|
267
|
+
: Translates characters in a string.
|
|
268
|
+
: @param $arg The input string
|
|
269
|
+
: @param $mapString Characters to replace
|
|
270
|
+
: @param $transString Replacement characters
|
|
271
|
+
: @return The translated string
|
|
272
|
+
:)
|
|
273
|
+
declare function fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string external;
|
|
274
|
+
|
|
275
|
+
(:~
|
|
276
|
+
: Encodes a string for use in a URI component.
|
|
277
|
+
: @param $uri-part The string to encode
|
|
278
|
+
: @return The percent-encoded string
|
|
279
|
+
:)
|
|
280
|
+
declare function fn:encode-for-uri($uri-part as xs:string?) as xs:string external;
|
|
281
|
+
|
|
282
|
+
(:~
|
|
283
|
+
: Converts an IRI to a URI by percent-encoding non-ASCII characters.
|
|
284
|
+
: @param $iri The IRI string
|
|
285
|
+
: @return The URI string
|
|
286
|
+
:)
|
|
287
|
+
declare function fn:iri-to-uri($iri as xs:string?) as xs:string external;
|
|
288
|
+
|
|
289
|
+
(:~
|
|
290
|
+
: Encodes a URI for use in HTML. Only encodes characters not allowed in URIs.
|
|
291
|
+
: @param $uri The URI string
|
|
292
|
+
: @return The encoded URI
|
|
293
|
+
:)
|
|
294
|
+
declare function fn:escape-html-uri($uri as xs:string?) as xs:string external;
|
|
295
|
+
|
|
296
|
+
(:~
|
|
297
|
+
: Tests whether a string contains a substring.
|
|
298
|
+
: @param $arg1 The string to search
|
|
299
|
+
: @param $arg2 The substring to find
|
|
300
|
+
: @return true if $arg1 contains $arg2
|
|
301
|
+
:)
|
|
302
|
+
declare function fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external;
|
|
303
|
+
(:~ @param $arg1 The string to search @param $arg2 The substring @param $collation Collation URI :)
|
|
304
|
+
declare function fn:contains($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external;
|
|
305
|
+
|
|
306
|
+
(:~
|
|
307
|
+
: Tests whether a string starts with a given prefix.
|
|
308
|
+
: @param $arg1 The string to test
|
|
309
|
+
: @param $arg2 The prefix to look for
|
|
310
|
+
: @return true if $arg1 starts with $arg2
|
|
311
|
+
:)
|
|
312
|
+
declare function fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external;
|
|
313
|
+
(:~ @param $arg1 The string @param $arg2 The prefix @param $collation Collation URI :)
|
|
314
|
+
declare function fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external;
|
|
315
|
+
|
|
316
|
+
(:~
|
|
317
|
+
: Tests whether a string ends with a given suffix.
|
|
318
|
+
: @param $arg1 The string to test
|
|
319
|
+
: @param $arg2 The suffix to look for
|
|
320
|
+
: @return true if $arg1 ends with $arg2
|
|
321
|
+
:)
|
|
322
|
+
declare function fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external;
|
|
323
|
+
(:~ @param $arg1 The string @param $arg2 The suffix @param $collation Collation URI :)
|
|
324
|
+
declare function fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external;
|
|
325
|
+
|
|
326
|
+
(:~
|
|
327
|
+
: Returns the part of a string that precedes the first occurrence of a pattern.
|
|
328
|
+
: @param $arg1 The input string
|
|
329
|
+
: @param $arg2 The pattern string
|
|
330
|
+
: @return The substring before the pattern
|
|
331
|
+
:)
|
|
332
|
+
declare function fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external;
|
|
333
|
+
(:~ @param $arg1 Input @param $arg2 Pattern @param $collation Collation URI :)
|
|
334
|
+
declare function fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external;
|
|
335
|
+
|
|
336
|
+
(:~
|
|
337
|
+
: Returns the part of a string that follows the first occurrence of a pattern.
|
|
338
|
+
: @param $arg1 The input string
|
|
339
|
+
: @param $arg2 The pattern string
|
|
340
|
+
: @return The substring after the pattern
|
|
341
|
+
:)
|
|
342
|
+
declare function fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external;
|
|
343
|
+
(:~ @param $arg1 Input @param $arg2 Pattern @param $collation Collation URI :)
|
|
344
|
+
declare function fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external;
|
|
345
|
+
|
|
346
|
+
(:~
|
|
347
|
+
: Tests whether a string matches a regular expression.
|
|
348
|
+
: @param $input The string to test
|
|
349
|
+
: @param $pattern The regex pattern
|
|
350
|
+
: @return true if the string matches
|
|
351
|
+
:)
|
|
352
|
+
declare function fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean external;
|
|
353
|
+
(:~ @param $input The string @param $pattern The regex @param $flags Flags (i, m, s, x) :)
|
|
354
|
+
declare function fn:matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean external;
|
|
355
|
+
|
|
356
|
+
(:~
|
|
357
|
+
: Replaces parts of a string matching a regex.
|
|
358
|
+
: @param $input The input string
|
|
359
|
+
: @param $pattern The regex pattern
|
|
360
|
+
: @param $replacement The replacement string (may use $0, $1 … back-references)
|
|
361
|
+
: @return The modified string
|
|
362
|
+
:)
|
|
363
|
+
declare function fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string external;
|
|
364
|
+
(:~ @param $input Input @param $pattern Regex @param $replacement Replacement @param $flags Flags :)
|
|
365
|
+
declare function fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string external;
|
|
366
|
+
|
|
367
|
+
(:~
|
|
368
|
+
: Splits a string on whitespace, returning a sequence of tokens.
|
|
369
|
+
: @param $input The input string
|
|
370
|
+
: @return Sequence of token strings
|
|
371
|
+
:)
|
|
372
|
+
declare function fn:tokenize($input as xs:string?) as xs:string* external;
|
|
373
|
+
(:~
|
|
374
|
+
: Splits a string on a regex delimiter.
|
|
375
|
+
: @param $input The input string
|
|
376
|
+
: @param $pattern The delimiter pattern
|
|
377
|
+
: @return Sequence of token strings
|
|
378
|
+
:)
|
|
379
|
+
declare function fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string* external;
|
|
380
|
+
(:~ @param $input Input @param $pattern Delimiter @param $flags Flags :)
|
|
381
|
+
declare function fn:tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* external;
|
|
382
|
+
|
|
383
|
+
(:~
|
|
384
|
+
: Applies a regex to a string, returning an XML analysis of matches and non-matches.
|
|
385
|
+
: @param $input The input string
|
|
386
|
+
: @param $pattern The regex pattern
|
|
387
|
+
: @return An fn:analyze-string-result element
|
|
388
|
+
:)
|
|
389
|
+
declare function fn:analyze-string($input as xs:string?, $pattern as xs:string) as element() external;
|
|
390
|
+
(:~ @param $input Input @param $pattern Regex @param $flags Flags :)
|
|
391
|
+
declare function fn:analyze-string($input as xs:string?, $pattern as xs:string, $flags as xs:string) as element() external;
|
|
392
|
+
|
|
393
|
+
(: ── URI functions ──────────────────────────────────────────────────────────── :)
|
|
394
|
+
|
|
395
|
+
(:~
|
|
396
|
+
: Resolves a relative URI against the static base URI.
|
|
397
|
+
: @param $relative The relative URI reference
|
|
398
|
+
: @return The resolved absolute URI
|
|
399
|
+
:)
|
|
400
|
+
declare function fn:resolve-uri($relative as xs:string?) as xs:anyURI? external;
|
|
401
|
+
(:~
|
|
402
|
+
: Resolves a relative URI against a given base URI.
|
|
403
|
+
: @param $relative The relative URI reference
|
|
404
|
+
: @param $base The base URI
|
|
405
|
+
: @return The resolved absolute URI
|
|
406
|
+
:)
|
|
407
|
+
declare function fn:resolve-uri($relative as xs:string?, $base as xs:string) as xs:anyURI? external;
|
|
408
|
+
|
|
409
|
+
(: ── Boolean functions ──────────────────────────────────────────────────────── :)
|
|
410
|
+
|
|
411
|
+
(:~
|
|
412
|
+
: Returns the xs:boolean value true.
|
|
413
|
+
: @return true
|
|
414
|
+
:)
|
|
415
|
+
declare function fn:true() as xs:boolean external;
|
|
416
|
+
|
|
417
|
+
(:~
|
|
418
|
+
: Returns the xs:boolean value false.
|
|
419
|
+
: @return false
|
|
420
|
+
:)
|
|
421
|
+
declare function fn:false() as xs:boolean external;
|
|
422
|
+
|
|
423
|
+
(:~
|
|
424
|
+
: Computes the effective boolean value of a sequence.
|
|
425
|
+
: @param $arg The sequence to evaluate
|
|
426
|
+
: @return The effective boolean value
|
|
427
|
+
:)
|
|
428
|
+
declare function fn:boolean($arg as item()*) as xs:boolean external;
|
|
429
|
+
|
|
430
|
+
(:~
|
|
431
|
+
: Returns the logical negation of the effective boolean value.
|
|
432
|
+
: @param $arg The sequence to negate
|
|
433
|
+
: @return The negated boolean value
|
|
434
|
+
:)
|
|
435
|
+
declare function fn:not($arg as item()*) as xs:boolean external;
|
|
436
|
+
|
|
437
|
+
(: ── Sequence functions ──────────────────────────────────────────────────────── :)
|
|
438
|
+
|
|
439
|
+
(:~
|
|
440
|
+
: Returns true if the argument is the empty sequence.
|
|
441
|
+
: @param $arg The sequence to test
|
|
442
|
+
: @return true if $arg is empty
|
|
443
|
+
:)
|
|
444
|
+
declare function fn:empty($arg as item()*) as xs:boolean external;
|
|
445
|
+
|
|
446
|
+
(:~
|
|
447
|
+
: Returns true if the argument is a non-empty sequence.
|
|
448
|
+
: @param $arg The sequence to test
|
|
449
|
+
: @return true if $arg is non-empty
|
|
450
|
+
:)
|
|
451
|
+
declare function fn:exists($arg as item()*) as xs:boolean external;
|
|
452
|
+
|
|
453
|
+
(:~
|
|
454
|
+
: Returns the first item in a sequence.
|
|
455
|
+
: @param $arg The sequence
|
|
456
|
+
: @return The first item, or empty sequence if $arg is empty
|
|
457
|
+
:)
|
|
458
|
+
declare function fn:head($arg as item()*) as item()? external;
|
|
459
|
+
|
|
460
|
+
(:~
|
|
461
|
+
: Returns all but the first item in a sequence.
|
|
462
|
+
: @param $arg The sequence
|
|
463
|
+
: @return The sequence without its first item
|
|
464
|
+
:)
|
|
465
|
+
declare function fn:tail($arg as item()*) as item()* external;
|
|
466
|
+
|
|
467
|
+
(:~
|
|
468
|
+
: Inserts items into a sequence at a given position.
|
|
469
|
+
: @param $target The target sequence
|
|
470
|
+
: @param $position 1-based insertion point
|
|
471
|
+
: @param $inserts Items to insert
|
|
472
|
+
: @return The modified sequence
|
|
473
|
+
:)
|
|
474
|
+
declare function fn:insert-before($target as item()*, $position as xs:integer, $inserts as item()*) as item()* external;
|
|
475
|
+
|
|
476
|
+
(:~
|
|
477
|
+
: Removes the item at a given position from a sequence.
|
|
478
|
+
: @param $target The sequence
|
|
479
|
+
: @param $position 1-based position to remove
|
|
480
|
+
: @return The sequence without the specified item
|
|
481
|
+
:)
|
|
482
|
+
declare function fn:remove($target as item()*, $position as xs:integer) as item()* external;
|
|
483
|
+
|
|
484
|
+
(:~
|
|
485
|
+
: Reverses the order of items in a sequence.
|
|
486
|
+
: @param $arg The sequence
|
|
487
|
+
: @return The sequence in reverse order
|
|
488
|
+
:)
|
|
489
|
+
declare function fn:reverse($arg as item()*) as item()* external;
|
|
490
|
+
|
|
491
|
+
(:~
|
|
492
|
+
: Returns a contiguous subsequence.
|
|
493
|
+
: @param $sourceSeq The source sequence
|
|
494
|
+
: @param $startingLoc 1-based start position
|
|
495
|
+
: @return Items from $startingLoc to the end
|
|
496
|
+
:)
|
|
497
|
+
declare function fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double) as item()* external;
|
|
498
|
+
(:~
|
|
499
|
+
: @param $sourceSeq The source sequence
|
|
500
|
+
: @param $startingLoc 1-based start position
|
|
501
|
+
: @param $length Number of items to return
|
|
502
|
+
: @return The subsequence
|
|
503
|
+
:)
|
|
504
|
+
declare function fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()* external;
|
|
505
|
+
|
|
506
|
+
(:~
|
|
507
|
+
: Returns the items in an implementation-defined order.
|
|
508
|
+
: @param $sourceSeq The sequence
|
|
509
|
+
: @return The sequence in any order
|
|
510
|
+
:)
|
|
511
|
+
declare function fn:unordered($sourceSeq as item()*) as item()* external;
|
|
512
|
+
|
|
513
|
+
(:~
|
|
514
|
+
: Returns the argument if it contains zero or one items; raises an error if it contains more.
|
|
515
|
+
: @param $arg The sequence
|
|
516
|
+
: @return The single item, or empty sequence
|
|
517
|
+
:)
|
|
518
|
+
declare function fn:zero-or-one($arg as item()*) as item()? external;
|
|
519
|
+
|
|
520
|
+
(:~
|
|
521
|
+
: Returns the argument if it contains one or more items; raises an error if it is empty.
|
|
522
|
+
: @param $arg The sequence
|
|
523
|
+
: @return The non-empty sequence
|
|
524
|
+
:)
|
|
525
|
+
declare function fn:one-or-more($arg as item()*) as item()+ external;
|
|
526
|
+
|
|
527
|
+
(:~
|
|
528
|
+
: Returns the argument if it contains exactly one item; raises an error otherwise.
|
|
529
|
+
: @param $arg The sequence
|
|
530
|
+
: @return The single item
|
|
531
|
+
:)
|
|
532
|
+
declare function fn:exactly-one($arg as item()*) as item() external;
|
|
533
|
+
|
|
534
|
+
(:~
|
|
535
|
+
: Returns distinct values from a sequence using value comparison.
|
|
536
|
+
: @param $arg The sequence of atomic values
|
|
537
|
+
: @return Sequence with duplicates removed
|
|
538
|
+
:)
|
|
539
|
+
declare function fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType* external;
|
|
540
|
+
(:~ @param $arg The sequence @param $collation Collation URI :)
|
|
541
|
+
declare function fn:distinct-values($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType* external;
|
|
542
|
+
|
|
543
|
+
(:~
|
|
544
|
+
: Returns positions in a sequence where a value occurs.
|
|
545
|
+
: @param $seq The sequence to search
|
|
546
|
+
: @param $search The value to find
|
|
547
|
+
: @return Sequence of 1-based positions
|
|
548
|
+
:)
|
|
549
|
+
declare function fn:index-of($seq as xs:anyAtomicType*, $search as xs:anyAtomicType) as xs:integer* external;
|
|
550
|
+
(:~ @param $seq Sequence @param $search Value @param $collation Collation URI :)
|
|
551
|
+
declare function fn:index-of($seq as xs:anyAtomicType*, $search as xs:anyAtomicType, $collation as xs:string) as xs:integer* external;
|
|
552
|
+
|
|
553
|
+
(:~
|
|
554
|
+
: Tests whether two sequences are deeply equal.
|
|
555
|
+
: @param $parameter1 First sequence
|
|
556
|
+
: @param $parameter2 Second sequence
|
|
557
|
+
: @return true if the sequences are deeply equal
|
|
558
|
+
:)
|
|
559
|
+
declare function fn:deep-equal($parameter1 as item()*, $parameter2 as item()*) as xs:boolean external;
|
|
560
|
+
(:~ @param $parameter1 First @param $parameter2 Second @param $collation Collation URI :)
|
|
561
|
+
declare function fn:deep-equal($parameter1 as item()*, $parameter2 as item()*, $collation as xs:string) as xs:boolean external;
|
|
562
|
+
|
|
563
|
+
(:~
|
|
564
|
+
: Returns the number of items in a sequence.
|
|
565
|
+
: @param $arg The sequence
|
|
566
|
+
: @return The count
|
|
567
|
+
:)
|
|
568
|
+
declare function fn:count($arg as item()*) as xs:integer external;
|
|
569
|
+
|
|
570
|
+
(:~
|
|
571
|
+
: Returns the average of a sequence of numeric values.
|
|
572
|
+
: @param $arg The sequence of numbers
|
|
573
|
+
: @return The average
|
|
574
|
+
:)
|
|
575
|
+
declare function fn:avg($arg as xs:anyAtomicType*) as xs:anyAtomicType? external;
|
|
576
|
+
|
|
577
|
+
(:~
|
|
578
|
+
: Returns the maximum value in a sequence.
|
|
579
|
+
: @param $arg The sequence
|
|
580
|
+
: @return The maximum value
|
|
581
|
+
:)
|
|
582
|
+
declare function fn:max($arg as xs:anyAtomicType*) as xs:anyAtomicType? external;
|
|
583
|
+
(:~ @param $arg Sequence @param $collation Collation URI :)
|
|
584
|
+
declare function fn:max($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType? external;
|
|
585
|
+
|
|
586
|
+
(:~
|
|
587
|
+
: Returns the minimum value in a sequence.
|
|
588
|
+
: @param $arg The sequence
|
|
589
|
+
: @return The minimum value
|
|
590
|
+
:)
|
|
591
|
+
declare function fn:min($arg as xs:anyAtomicType*) as xs:anyAtomicType? external;
|
|
592
|
+
(:~ @param $arg Sequence @param $collation Collation URI :)
|
|
593
|
+
declare function fn:min($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType? external;
|
|
594
|
+
|
|
595
|
+
(:~
|
|
596
|
+
: Returns the sum of a sequence of numeric values.
|
|
597
|
+
: @param $arg The sequence of numbers
|
|
598
|
+
: @return The sum, or 0 if empty
|
|
599
|
+
:)
|
|
600
|
+
declare function fn:sum($arg as xs:anyAtomicType*) as xs:anyAtomicType external;
|
|
601
|
+
(:~
|
|
602
|
+
: @param $arg The sequence
|
|
603
|
+
: @param $zero Value to return for an empty sequence
|
|
604
|
+
: @return The sum, or $zero if empty
|
|
605
|
+
:)
|
|
606
|
+
declare function fn:sum($arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType? external;
|
|
607
|
+
|
|
608
|
+
(: ── Higher-order functions ─────────────────────────────────────────────────── :)
|
|
609
|
+
|
|
610
|
+
(:~
|
|
611
|
+
: Applies a function to every item in a sequence.
|
|
612
|
+
: @param $seq The input sequence
|
|
613
|
+
: @param $action Function to apply to each item
|
|
614
|
+
: @return Concatenated results
|
|
615
|
+
:)
|
|
616
|
+
declare function fn:for-each($seq as item()*, $action as function(item()) as item()*) as item()* external;
|
|
617
|
+
|
|
618
|
+
(:~
|
|
619
|
+
: Returns items from a sequence for which a predicate is true.
|
|
620
|
+
: @param $seq The input sequence
|
|
621
|
+
: @param $f Predicate function
|
|
622
|
+
: @return Items where $f returns true
|
|
623
|
+
:)
|
|
624
|
+
declare function fn:filter($seq as item()*, $f as function(item()) as xs:boolean) as item()* external;
|
|
625
|
+
|
|
626
|
+
(:~
|
|
627
|
+
: Reduces a sequence to a single value by applying a function from the left.
|
|
628
|
+
: @param $seq The input sequence
|
|
629
|
+
: @param $zero The initial accumulator value
|
|
630
|
+
: @param $f Combining function
|
|
631
|
+
: @return The accumulated result
|
|
632
|
+
:)
|
|
633
|
+
declare function fn:fold-left($seq as item()*, $zero as item()*, $f as function(item()*, item()) as item()*) as item()* external;
|
|
634
|
+
|
|
635
|
+
(:~
|
|
636
|
+
: Reduces a sequence to a single value by applying a function from the right.
|
|
637
|
+
: @param $seq The input sequence
|
|
638
|
+
: @param $zero The initial accumulator value
|
|
639
|
+
: @param $f Combining function
|
|
640
|
+
: @return The accumulated result
|
|
641
|
+
:)
|
|
642
|
+
declare function fn:fold-right($seq as item()*, $zero as item()*, $f as function(item(), item()*) as item()*) as item()* external;
|
|
643
|
+
|
|
644
|
+
(:~
|
|
645
|
+
: Applies a function pairwise to two sequences.
|
|
646
|
+
: @param $seq1 First sequence
|
|
647
|
+
: @param $seq2 Second sequence
|
|
648
|
+
: @param $action Function to apply to each pair
|
|
649
|
+
: @return Concatenated results
|
|
650
|
+
:)
|
|
651
|
+
declare function fn:for-each-pair($seq1 as item()*, $seq2 as item()*, $action as function(item(), item()) as item()*) as item()* external;
|
|
652
|
+
|
|
653
|
+
(:~
|
|
654
|
+
: Sorts a sequence using the default collation and natural ordering.
|
|
655
|
+
: @param $seq The sequence to sort
|
|
656
|
+
: @return The sorted sequence
|
|
657
|
+
:)
|
|
658
|
+
declare function fn:sort($seq as item()*) as item()* external;
|
|
659
|
+
(:~ @param $seq Sequence @param $collation Collation URI or empty :)
|
|
660
|
+
declare function fn:sort($seq as item()*, $collation as xs:string?) as item()* external;
|
|
661
|
+
(:~
|
|
662
|
+
: @param $seq Sequence
|
|
663
|
+
: @param $collation Collation URI or empty
|
|
664
|
+
: @param $key Function that extracts the sort key from an item
|
|
665
|
+
: @return The sorted sequence
|
|
666
|
+
:)
|
|
667
|
+
declare function fn:sort($seq as item()*, $collation as xs:string?, $key as function(item()) as xs:anyAtomicType*) as item()* external;
|
|
668
|
+
|
|
669
|
+
(:~
|
|
670
|
+
: Calls a function with arguments supplied as an array.
|
|
671
|
+
: @param $function The function to call
|
|
672
|
+
: @param $array Array of arguments
|
|
673
|
+
: @return The result of the function call
|
|
674
|
+
:)
|
|
675
|
+
declare function fn:apply($function as function(*), $array as array(*)) as item()* external;
|
|
676
|
+
|
|
677
|
+
(: ── Function introspection ─────────────────────────────────────────────────── :)
|
|
678
|
+
|
|
679
|
+
(:~
|
|
680
|
+
: Returns a function from the in-scope functions by name and arity, or empty if not found.
|
|
681
|
+
: @param $name The function name as a QName
|
|
682
|
+
: @param $arity The function arity
|
|
683
|
+
: @return The function, or empty sequence
|
|
684
|
+
:)
|
|
685
|
+
declare function fn:function-lookup($name as xs:QName, $arity as xs:integer) as function(*)? external;
|
|
686
|
+
|
|
687
|
+
(:~
|
|
688
|
+
: Returns the name of a function item.
|
|
689
|
+
: @param $func The function
|
|
690
|
+
: @return The function name as a QName, or empty for anonymous functions
|
|
691
|
+
:)
|
|
692
|
+
declare function fn:function-name($func as function(*)) as xs:QName? external;
|
|
693
|
+
|
|
694
|
+
(:~
|
|
695
|
+
: Returns the arity of a function item.
|
|
696
|
+
: @param $func The function
|
|
697
|
+
: @return The number of arguments the function accepts
|
|
698
|
+
:)
|
|
699
|
+
declare function fn:function-arity($func as function(*)) as xs:integer external;
|
|
700
|
+
|
|
701
|
+
(: ── QName functions ────────────────────────────────────────────────────────── :)
|
|
702
|
+
|
|
703
|
+
(:~
|
|
704
|
+
: Constructs a QName from a namespace URI and a lexical QName.
|
|
705
|
+
: @param $paramURI The namespace URI (empty string for no namespace)
|
|
706
|
+
: @param $paramQName The lexical qualified name, e.g. "prefix:local"
|
|
707
|
+
: @return The QName value
|
|
708
|
+
:)
|
|
709
|
+
declare function fn:QName($paramURI as xs:string?, $paramQName as xs:string) as xs:QName external;
|
|
710
|
+
|
|
711
|
+
(:~
|
|
712
|
+
: Resolves a lexical QName in the context of an element's in-scope namespaces.
|
|
713
|
+
: @param $qname The lexical QName string
|
|
714
|
+
: @param $element The element providing in-scope namespaces
|
|
715
|
+
: @return The resolved QName
|
|
716
|
+
:)
|
|
717
|
+
declare function fn:resolve-QName($qname as xs:string?, $element as element()) as xs:QName? external;
|
|
718
|
+
|
|
719
|
+
(:~
|
|
720
|
+
: Returns the namespace URI of a QName.
|
|
721
|
+
: @param $arg The QName
|
|
722
|
+
: @return The namespace URI
|
|
723
|
+
:)
|
|
724
|
+
declare function fn:namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI? external;
|
|
725
|
+
|
|
726
|
+
(:~
|
|
727
|
+
: Returns the namespace URI for a given prefix within an element's in-scope namespaces.
|
|
728
|
+
: @param $prefix The namespace prefix (empty string for the default namespace)
|
|
729
|
+
: @param $element The element providing in-scope namespaces
|
|
730
|
+
: @return The namespace URI
|
|
731
|
+
:)
|
|
732
|
+
declare function fn:namespace-uri-for-prefix($prefix as xs:string?, $element as element()) as xs:anyURI? external;
|
|
733
|
+
|
|
734
|
+
(:~
|
|
735
|
+
: Returns the in-scope namespace prefixes of an element.
|
|
736
|
+
: @param $element The element
|
|
737
|
+
: @return Sequence of prefix strings
|
|
738
|
+
:)
|
|
739
|
+
declare function fn:in-scope-prefixes($element as element()) as xs:string* external;
|
|
740
|
+
|
|
741
|
+
(:~
|
|
742
|
+
: Returns the prefix part of a QName.
|
|
743
|
+
: @param $arg The QName
|
|
744
|
+
: @return The prefix, or empty sequence if no prefix
|
|
745
|
+
:)
|
|
746
|
+
declare function fn:prefix-from-QName($arg as xs:QName?) as xs:NCName? external;
|
|
747
|
+
|
|
748
|
+
(:~
|
|
749
|
+
: Returns the local part of a QName.
|
|
750
|
+
: @param $arg The QName
|
|
751
|
+
: @return The local name
|
|
752
|
+
:)
|
|
753
|
+
declare function fn:local-name-from-QName($arg as xs:QName?) as xs:NCName? external;
|
|
754
|
+
|
|
755
|
+
(: ── Node functions ─────────────────────────────────────────────────────────── :)
|
|
756
|
+
|
|
757
|
+
(:~ Returns the name of the context node as a string. :)
|
|
758
|
+
declare function fn:name() as xs:string external;
|
|
759
|
+
(:~
|
|
760
|
+
: Returns the name of a node as a string.
|
|
761
|
+
: @param $arg The node
|
|
762
|
+
: @return The node name string
|
|
763
|
+
:)
|
|
764
|
+
declare function fn:name($arg as node()?) as xs:string external;
|
|
765
|
+
|
|
766
|
+
(:~ Returns the local name of the context node. :)
|
|
767
|
+
declare function fn:local-name() as xs:string external;
|
|
768
|
+
(:~
|
|
769
|
+
: Returns the local name of a node.
|
|
770
|
+
: @param $arg The node
|
|
771
|
+
: @return The local name string
|
|
772
|
+
:)
|
|
773
|
+
declare function fn:local-name($arg as node()?) as xs:string external;
|
|
774
|
+
|
|
775
|
+
(:~ Returns the namespace URI of the context node. :)
|
|
776
|
+
declare function fn:namespace-uri() as xs:anyURI external;
|
|
777
|
+
(:~
|
|
778
|
+
: Returns the namespace URI of a node.
|
|
779
|
+
: @param $arg The node
|
|
780
|
+
: @return The namespace URI
|
|
781
|
+
:)
|
|
782
|
+
declare function fn:namespace-uri($arg as node()?) as xs:anyURI external;
|
|
783
|
+
|
|
784
|
+
(:~
|
|
785
|
+
: Tests whether the context node has a given language.
|
|
786
|
+
: @param $testlang The language to test for
|
|
787
|
+
: @return true if the node's language matches
|
|
788
|
+
:)
|
|
789
|
+
declare function fn:lang($testlang as xs:string?) as xs:boolean external;
|
|
790
|
+
(:~ @param $testlang Language @param $node The node to test :)
|
|
791
|
+
declare function fn:lang($testlang as xs:string?, $node as node()) as xs:boolean external;
|
|
792
|
+
|
|
793
|
+
(:~ Returns the root of the tree containing the context node. :)
|
|
794
|
+
declare function fn:root() as node() external;
|
|
795
|
+
(:~
|
|
796
|
+
: Returns the root of the tree containing a node.
|
|
797
|
+
: @param $arg The node
|
|
798
|
+
: @return The root node
|
|
799
|
+
:)
|
|
800
|
+
declare function fn:root($arg as node()?) as node()? external;
|
|
801
|
+
|
|
802
|
+
(:~ Returns the path to the context node. :)
|
|
803
|
+
declare function fn:path() as xs:string? external;
|
|
804
|
+
(:~
|
|
805
|
+
: Returns an XPath expression that uniquely identifies a node within its document.
|
|
806
|
+
: @param $arg The node
|
|
807
|
+
: @return The path string
|
|
808
|
+
:)
|
|
809
|
+
declare function fn:path($arg as node()?) as xs:string? external;
|
|
810
|
+
|
|
811
|
+
(:~ Tests whether the context node has child nodes. :)
|
|
812
|
+
declare function fn:has-children() as xs:boolean external;
|
|
813
|
+
(:~
|
|
814
|
+
: Tests whether a node has child nodes.
|
|
815
|
+
: @param $node The node to test
|
|
816
|
+
: @return true if the node has children
|
|
817
|
+
:)
|
|
818
|
+
declare function fn:has-children($node as node()?) as xs:boolean external;
|
|
819
|
+
|
|
820
|
+
(:~
|
|
821
|
+
: Returns nodes from a sequence that have no ancestor in the sequence.
|
|
822
|
+
: @param $nodes The sequence of nodes
|
|
823
|
+
: @return The innermost nodes
|
|
824
|
+
:)
|
|
825
|
+
declare function fn:innermost($nodes as node()*) as node()* external;
|
|
826
|
+
|
|
827
|
+
(:~
|
|
828
|
+
: Returns nodes from a sequence that have no descendant in the sequence.
|
|
829
|
+
: @param $nodes The sequence of nodes
|
|
830
|
+
: @return The outermost nodes
|
|
831
|
+
:)
|
|
832
|
+
declare function fn:outermost($nodes as node()*) as node()* external;
|
|
833
|
+
|
|
834
|
+
(:~ Generates a unique ID string for the context node. :)
|
|
835
|
+
declare function fn:generate-id() as xs:string external;
|
|
836
|
+
(:~
|
|
837
|
+
: Generates a unique ID string for a node.
|
|
838
|
+
: @param $arg The node
|
|
839
|
+
: @return A unique xs:ID string
|
|
840
|
+
:)
|
|
841
|
+
declare function fn:generate-id($arg as node()?) as xs:string external;
|
|
842
|
+
|
|
843
|
+
(: ── Context functions ──────────────────────────────────────────────────────── :)
|
|
844
|
+
|
|
845
|
+
(:~
|
|
846
|
+
: Returns the position of the context item in the sequence being processed.
|
|
847
|
+
: @return The 1-based context position
|
|
848
|
+
:)
|
|
849
|
+
declare function fn:position() as xs:integer external;
|
|
850
|
+
|
|
851
|
+
(:~
|
|
852
|
+
: Returns the number of items in the sequence being processed.
|
|
853
|
+
: @return The context size
|
|
854
|
+
:)
|
|
855
|
+
declare function fn:last() as xs:integer external;
|
|
856
|
+
|
|
857
|
+
(:~
|
|
858
|
+
: Returns the current date and time with timezone.
|
|
859
|
+
: @return The current dateTime
|
|
860
|
+
:)
|
|
861
|
+
declare function fn:current-dateTime() as xs:dateTime external;
|
|
862
|
+
|
|
863
|
+
(:~
|
|
864
|
+
: Returns the current date with timezone.
|
|
865
|
+
: @return The current date
|
|
866
|
+
:)
|
|
867
|
+
declare function fn:current-date() as xs:date external;
|
|
868
|
+
|
|
869
|
+
(:~
|
|
870
|
+
: Returns the current time with timezone.
|
|
871
|
+
: @return The current time
|
|
872
|
+
:)
|
|
873
|
+
declare function fn:current-time() as xs:time external;
|
|
874
|
+
|
|
875
|
+
(:~
|
|
876
|
+
: Returns the implicit timezone.
|
|
877
|
+
: @return The implicit timezone as a dayTimeDuration
|
|
878
|
+
:)
|
|
879
|
+
declare function fn:implicit-timezone() as xs:dayTimeDuration external;
|
|
880
|
+
|
|
881
|
+
(:~
|
|
882
|
+
: Returns the default collation.
|
|
883
|
+
: @return The default collation URI
|
|
884
|
+
:)
|
|
885
|
+
declare function fn:default-collation() as xs:string external;
|
|
886
|
+
|
|
887
|
+
(:~
|
|
888
|
+
: Returns the default language.
|
|
889
|
+
: @return The default language
|
|
890
|
+
:)
|
|
891
|
+
declare function fn:default-language() as xs:language external;
|
|
892
|
+
|
|
893
|
+
(:~
|
|
894
|
+
: Returns the static base URI.
|
|
895
|
+
: @return The static base URI, or empty sequence if none
|
|
896
|
+
:)
|
|
897
|
+
declare function fn:static-base-uri() as xs:anyURI? external;
|
|
898
|
+
|
|
899
|
+
(: ── Date/time component extraction ────────────────────────────────────────── :)
|
|
900
|
+
|
|
901
|
+
(:~
|
|
902
|
+
: Creates a dateTime value from a date and a time.
|
|
903
|
+
: @param $arg1 The date part
|
|
904
|
+
: @param $arg2 The time part
|
|
905
|
+
: @return The combined dateTime
|
|
906
|
+
:)
|
|
907
|
+
declare function fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime? external;
|
|
908
|
+
|
|
909
|
+
(:~ @param $arg A duration @return The years component :)
|
|
910
|
+
declare function fn:years-from-duration($arg as xs:duration?) as xs:integer? external;
|
|
911
|
+
(:~ @param $arg A duration @return The months component :)
|
|
912
|
+
declare function fn:months-from-duration($arg as xs:duration?) as xs:integer? external;
|
|
913
|
+
(:~ @param $arg A duration @return The days component :)
|
|
914
|
+
declare function fn:days-from-duration($arg as xs:duration?) as xs:integer? external;
|
|
915
|
+
(:~ @param $arg A duration @return The hours component :)
|
|
916
|
+
declare function fn:hours-from-duration($arg as xs:duration?) as xs:integer? external;
|
|
917
|
+
(:~ @param $arg A duration @return The minutes component :)
|
|
918
|
+
declare function fn:minutes-from-duration($arg as xs:duration?) as xs:integer? external;
|
|
919
|
+
(:~ @param $arg A duration @return The seconds component :)
|
|
920
|
+
declare function fn:seconds-from-duration($arg as xs:duration?) as xs:decimal? external;
|
|
921
|
+
|
|
922
|
+
(:~ @param $arg A dateTime @return The year component :)
|
|
923
|
+
declare function fn:year-from-dateTime($arg as xs:dateTime?) as xs:integer? external;
|
|
924
|
+
(:~ @param $arg A dateTime @return The month component (1–12) :)
|
|
925
|
+
declare function fn:month-from-dateTime($arg as xs:dateTime?) as xs:integer? external;
|
|
926
|
+
(:~ @param $arg A dateTime @return The day-of-month component (1–31) :)
|
|
927
|
+
declare function fn:day-from-dateTime($arg as xs:dateTime?) as xs:integer? external;
|
|
928
|
+
(:~ @param $arg A dateTime @return The hours component (0–23) :)
|
|
929
|
+
declare function fn:hours-from-dateTime($arg as xs:dateTime?) as xs:integer? external;
|
|
930
|
+
(:~ @param $arg A dateTime @return The minutes component (0–59) :)
|
|
931
|
+
declare function fn:minutes-from-dateTime($arg as xs:dateTime?) as xs:integer? external;
|
|
932
|
+
(:~ @param $arg A dateTime @return The seconds component :)
|
|
933
|
+
declare function fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal? external;
|
|
934
|
+
(:~ @param $arg A dateTime @return The timezone as a dayTimeDuration :)
|
|
935
|
+
declare function fn:timezone-from-dateTime($arg as xs:dateTime?) as xs:dayTimeDuration? external;
|
|
936
|
+
|
|
937
|
+
(:~ @param $arg A date @return The year component :)
|
|
938
|
+
declare function fn:year-from-date($arg as xs:date?) as xs:integer? external;
|
|
939
|
+
(:~ @param $arg A date @return The month component (1–12) :)
|
|
940
|
+
declare function fn:month-from-date($arg as xs:date?) as xs:integer? external;
|
|
941
|
+
(:~ @param $arg A date @return The day-of-month component (1–31) :)
|
|
942
|
+
declare function fn:day-from-date($arg as xs:date?) as xs:integer? external;
|
|
943
|
+
(:~ @param $arg A date @return The timezone as a dayTimeDuration :)
|
|
944
|
+
declare function fn:timezone-from-date($arg as xs:date?) as xs:dayTimeDuration? external;
|
|
945
|
+
|
|
946
|
+
(:~ @param $arg A time @return The hours component (0–23) :)
|
|
947
|
+
declare function fn:hours-from-time($arg as xs:time?) as xs:integer? external;
|
|
948
|
+
(:~ @param $arg A time @return The minutes component (0–59) :)
|
|
949
|
+
declare function fn:minutes-from-time($arg as xs:time?) as xs:integer? external;
|
|
950
|
+
(:~ @param $arg A time @return The seconds component :)
|
|
951
|
+
declare function fn:seconds-from-time($arg as xs:time?) as xs:decimal? external;
|
|
952
|
+
(:~ @param $arg A time @return The timezone as a dayTimeDuration :)
|
|
953
|
+
declare function fn:timezone-from-time($arg as xs:time?) as xs:dayTimeDuration? external;
|
|
954
|
+
|
|
955
|
+
(:~
|
|
956
|
+
: Adjusts a dateTime to the implicit timezone.
|
|
957
|
+
: @param $arg The dateTime to adjust
|
|
958
|
+
: @return The adjusted dateTime
|
|
959
|
+
:)
|
|
960
|
+
declare function fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as xs:dateTime? external;
|
|
961
|
+
(:~
|
|
962
|
+
: Adjusts a dateTime to a given timezone.
|
|
963
|
+
: @param $arg The dateTime to adjust
|
|
964
|
+
: @param $timezone The target timezone, or empty sequence to remove timezone
|
|
965
|
+
: @return The adjusted dateTime
|
|
966
|
+
:)
|
|
967
|
+
declare function fn:adjust-dateTime-to-timezone($arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime? external;
|
|
968
|
+
|
|
969
|
+
(:~ @param $arg Date to adjust @return Adjusted to implicit timezone :)
|
|
970
|
+
declare function fn:adjust-date-to-timezone($arg as xs:date?) as xs:date? external;
|
|
971
|
+
(:~ @param $arg Date @param $timezone Target timezone :)
|
|
972
|
+
declare function fn:adjust-date-to-timezone($arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date? external;
|
|
973
|
+
|
|
974
|
+
(:~ @param $arg Time to adjust @return Adjusted to implicit timezone :)
|
|
975
|
+
declare function fn:adjust-time-to-timezone($arg as xs:time?) as xs:time? external;
|
|
976
|
+
(:~ @param $arg Time @param $timezone Target timezone :)
|
|
977
|
+
declare function fn:adjust-time-to-timezone($arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time? external;
|
|
978
|
+
|
|
979
|
+
(:~
|
|
980
|
+
: Formats a dateTime value as a string using a picture string.
|
|
981
|
+
: @param $value The dateTime to format
|
|
982
|
+
: @param $picture The picture string
|
|
983
|
+
: @return The formatted string
|
|
984
|
+
:)
|
|
985
|
+
declare function fn:format-dateTime($value as xs:dateTime?, $picture as xs:string) as xs:string? external;
|
|
986
|
+
(:~ @param $value dateTime @param $picture Picture @param $language Language @param $calendar Calendar @param $place Place :)
|
|
987
|
+
declare function fn:format-dateTime($value as xs:dateTime?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external;
|
|
988
|
+
|
|
989
|
+
(:~ @param $value Date @param $picture Picture @return Formatted date string :)
|
|
990
|
+
declare function fn:format-date($value as xs:date?, $picture as xs:string) as xs:string? external;
|
|
991
|
+
(:~ @param $value Date @param $picture Picture @param $language Language @param $calendar Calendar @param $place Place :)
|
|
992
|
+
declare function fn:format-date($value as xs:date?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external;
|
|
993
|
+
|
|
994
|
+
(:~ @param $value Time @param $picture Picture @return Formatted time string :)
|
|
995
|
+
declare function fn:format-time($value as xs:time?, $picture as xs:string) as xs:string? external;
|
|
996
|
+
(:~ @param $value Time @param $picture Picture @param $language Language @param $calendar Calendar @param $place Place :)
|
|
997
|
+
declare function fn:format-time($value as xs:time?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external;
|
|
998
|
+
|
|
999
|
+
(: ── Document and collection functions ──────────────────────────────────────── :)
|
|
1000
|
+
|
|
1001
|
+
(:~
|
|
1002
|
+
: Returns the document at a given URI.
|
|
1003
|
+
: @param $uri The document URI
|
|
1004
|
+
: @return The document node
|
|
1005
|
+
:)
|
|
1006
|
+
declare function fn:doc($uri as xs:string?) as document-node()? external;
|
|
1007
|
+
|
|
1008
|
+
(:~
|
|
1009
|
+
: Tests whether a document is available at a given URI.
|
|
1010
|
+
: @param $uri The document URI
|
|
1011
|
+
: @return true if the document is available
|
|
1012
|
+
:)
|
|
1013
|
+
declare function fn:doc-available($uri as xs:string?) as xs:boolean external;
|
|
1014
|
+
|
|
1015
|
+
(:~ Returns all documents in the default collection. :)
|
|
1016
|
+
declare function fn:collection() as item()* external;
|
|
1017
|
+
(:~
|
|
1018
|
+
: Returns a collection of documents or nodes.
|
|
1019
|
+
: @param $arg The collection URI
|
|
1020
|
+
: @return The items in the collection
|
|
1021
|
+
:)
|
|
1022
|
+
declare function fn:collection($arg as xs:string?) as item()* external;
|
|
1023
|
+
|
|
1024
|
+
(:~ Returns the URIs in the default URI collection. :)
|
|
1025
|
+
declare function fn:uri-collection() as xs:anyURI* external;
|
|
1026
|
+
(:~
|
|
1027
|
+
: Returns the URIs in a named URI collection.
|
|
1028
|
+
: @param $arg The collection URI
|
|
1029
|
+
: @return Sequence of URIs
|
|
1030
|
+
:)
|
|
1031
|
+
declare function fn:uri-collection($arg as xs:string?) as xs:anyURI* external;
|
|
1032
|
+
|
|
1033
|
+
(:~
|
|
1034
|
+
: Returns the content of a text file.
|
|
1035
|
+
: @param $href The URI of the text file
|
|
1036
|
+
: @return The file content as a string
|
|
1037
|
+
:)
|
|
1038
|
+
declare function fn:unparsed-text($href as xs:string?) as xs:string? external;
|
|
1039
|
+
(:~ @param $href URI @param $encoding Character encoding :)
|
|
1040
|
+
declare function fn:unparsed-text($href as xs:string?, $encoding as xs:string) as xs:string? external;
|
|
1041
|
+
|
|
1042
|
+
(:~
|
|
1043
|
+
: Returns the lines of a text file as a sequence of strings.
|
|
1044
|
+
: @param $href The URI of the text file
|
|
1045
|
+
: @return Sequence of line strings
|
|
1046
|
+
:)
|
|
1047
|
+
declare function fn:unparsed-text-lines($href as xs:string?) as xs:string* external;
|
|
1048
|
+
(:~ @param $href URI @param $encoding Character encoding :)
|
|
1049
|
+
declare function fn:unparsed-text-lines($href as xs:string?, $encoding as xs:string) as xs:string* external;
|
|
1050
|
+
|
|
1051
|
+
(:~
|
|
1052
|
+
: Tests whether a text file is available.
|
|
1053
|
+
: @param $href The URI to test
|
|
1054
|
+
: @return true if the resource is available
|
|
1055
|
+
:)
|
|
1056
|
+
declare function fn:unparsed-text-available($href as xs:string?) as xs:boolean external;
|
|
1057
|
+
(:~ @param $href URI @param $encoding Character encoding :)
|
|
1058
|
+
declare function fn:unparsed-text-available($href as xs:string?, $encoding as xs:string) as xs:boolean external;
|
|
1059
|
+
|
|
1060
|
+
(:~
|
|
1061
|
+
: Returns the value of a named environment variable.
|
|
1062
|
+
: @param $name The variable name
|
|
1063
|
+
: @return The variable value, or empty sequence if not set
|
|
1064
|
+
:)
|
|
1065
|
+
declare function fn:environment-variable($name as xs:string) as xs:string? external;
|
|
1066
|
+
|
|
1067
|
+
(:~
|
|
1068
|
+
: Returns the names of all available environment variables.
|
|
1069
|
+
: @return Sequence of variable name strings
|
|
1070
|
+
:)
|
|
1071
|
+
declare function fn:available-environment-variables() as xs:string* external;
|
|
1072
|
+
|
|
1073
|
+
(: ── XML identity functions ─────────────────────────────────────────────────── :)
|
|
1074
|
+
|
|
1075
|
+
(:~
|
|
1076
|
+
: Returns elements with the given IDs in the document containing the context node.
|
|
1077
|
+
: @param $arg Sequence of ID strings
|
|
1078
|
+
: @return The matching elements
|
|
1079
|
+
:)
|
|
1080
|
+
declare function fn:id($arg as xs:string*) as element()* external;
|
|
1081
|
+
(:~ @param $arg ID strings @param $node Node in the target document :)
|
|
1082
|
+
declare function fn:id($arg as xs:string*, $node as node()) as element()* external;
|
|
1083
|
+
|
|
1084
|
+
(:~
|
|
1085
|
+
: Returns nodes with an IDREF attribute matching the given IDs.
|
|
1086
|
+
: @param $arg Sequence of ID strings
|
|
1087
|
+
: @return The matching nodes
|
|
1088
|
+
:)
|
|
1089
|
+
declare function fn:idref($arg as xs:string*) as node()* external;
|
|
1090
|
+
(:~ @param $arg ID strings @param $node Node in the target document :)
|
|
1091
|
+
declare function fn:idref($arg as xs:string*, $node as node()) as node()* external;
|
|
1092
|
+
|
|
1093
|
+
(:~
|
|
1094
|
+
: Returns elements whose ID attribute matches one of the given strings.
|
|
1095
|
+
: @param $arg Sequence of ID strings
|
|
1096
|
+
: @return The matching elements
|
|
1097
|
+
:)
|
|
1098
|
+
declare function fn:element-with-id($arg as xs:string*) as element()* external;
|
|
1099
|
+
(:~ @param $arg ID strings @param $node Node in the target document :)
|
|
1100
|
+
declare function fn:element-with-id($arg as xs:string*, $node as node()) as element()* external;
|