How many three digit numbers are there in which the sum of the digits is even?
Correct option (A) 450 Show
Let the three-digits of number n = x1,x2,x3. Since, x1 + x2 + x3 is even, there are following cases: (a) x1,x2,x3 all are even. So 4. 5. 5 = 100 ways (b) x1 even and x2 , x3 are odd. So 4. 5. 5 = 100 ways (c) x1 odd, x2 even, x3 odd. So 5. 5. 5 = 125 ways (d) x1 odd, x2 odd, x3 even. So 5. 5. 5 = 125 ways Solution : Case I : All the digits are even Number of numbers `=4xx5xx5=100` Case II : One digit is even and two digits are odd If fist digit is even then number of numbers `=5xx5xx5=125` If third digit is even then number of numbers `=5xx5xx5=125` So, total number of numbers `=100+100+125+125=450` Unfortunately, the footnote ends there, so there's not much in the way of detail about what these restrictions are or how long they'd remain in effect in a potential post-acquisition world. Given COD's continued non-appearance on Game Pass, you've got to imagine the restrictions are fairly significant if they're not an outright block on COD coming to the service. Either way, the simple fact that Microsoft is apparently willing to maintain any restrictions on its own ability to put first-party games on Game Pass is rather remarkable, given that making Game Pass more appealing is one of the reasons for its acquisition spree. The irony of Sony making deals like this one while fretting about COD's future on PlayStation probably isn't lost on Microsoft's lawyers, which is no doubt part of why they brought it up to the CMA. While it's absolutely reasonable to worry about a world in which more and more properties are concentrated in the hands of singular, giant megacorps, it does look a bit odd if you're complaining about losing access to games while stopping them from joining competing services. The purpose of this document is to catalog the functions and operators required for XPath 3.1, XQuery 3.1, and XSLT 3.0 (at the time of writing, XSLT 3.0 requires support for version 3.0 of this specification, and makes support for version 3.1 optional). The exact syntax used to call these functions and operators is specified in [XML Path Language (XPath) 3.1], [XQuery 3.1: An XML Query Language] and [XSL Transformations (XSLT) Version 3.0]. This document defines three classes of functions:
[XML Schema Part 2: Datatypes Second Edition] defines a number of primitive and derived datatypes, collectively known as built-in datatypes. This document defines functions and operations on these datatypes as well as the other types (for example, nodes and sequences of nodes) defined in Section 2.7 Schema Information DM31 of the [XQuery and XPath Data Model (XDM) 3.1]. These functions and operations are available for use in [XML Path Language (XPath) 3.1], [XQuery 3.1: An XML Query Language] and any other host language that chooses to reference them. In particular, they may be referenced in future versions of XSLT and related XML standards. [Schema 1.1 Part 2] adds to the datatypes defined in [XML Schema Part 2: Datatypes Second Edition]. It introduces a new derived type let $para :=23, and it incorporates as built-in types the two types let $para :=24 and let $para :=25 which were previously XDM additions to the type system. In addition, XSD 1.1 clarifies and updates many aspects of the definitions of the existing datatypes: for example, it extends the value space of let $para :=26 to allow both positive and negative zero, and extends the lexical space to allow let $para :=27; it modifies the value space of let $para :=28 to permit additional Unicode characters; it allows year zero and disallows leap seconds in let $para :=29 values; and it allows any character string to appear as the value of an let $para :=30 item. Implementations of this specification may support either XSD 1.0 or XSD 1.1 or both. References to specific sections of some of the above documents are indicated by cross-document links in this document. Each such link consists of a pointer to a specific section followed a superscript specifying the linked document. The superscripts have the following meanings: 'XQ' [XQuery 3.1: An XML Query Language], 'XT' [XSL Transformations (XSLT) Version 3.0], 'XP' [XML Path Language (XPath) 3.1], and 'DM' [XQuery and XPath Data Model (XDM) 3.1]. 1.1 ConformanceThis recommendation contains a set of function specifications. It defines conformance at the level of individual functions. An implementation of a function conforms to a function specification in this recommendation if all the following conditions are satisfied:
Other recommendations ("host languages") that reference this document may dictate:
Any behavior that is discretionary (implementation-defined or implementation-dependent) in this specification may be constrained by a host language. Note: Adding such constraints in a host language, however, is discouraged because it makes it difficult to re-use implementations of the function library across host languages. This specification allows flexibility in the choice of versions of specifications on which it depends:
Note: The XML Schema 1.1 recommendation introduces one new concrete datatype: let $para :=23; it also incorporates the types let $para :=25, let $para :=24, and let $para :=34 which were previously defined in earlier versions of [XQuery and XPath Data Model (XDM) 3.1]. Furthermore, XSD 1.1 includes the option of supporting revised definitions of types such as let $para :=35 based on the rules in XML 1.1 rather than 1.0. In this document, text labeled as an example or as a Note is provided for explanatory purposes and is not normative. 1.2 Namespaces and prefixesThe functions and operators defined in this document are contained in one of several namespaces (see [Namespaces in XML]) and referenced using an let $para :=36. This document uses conventional prefixes to refer to these namespaces. User-written applications can choose a different prefix to refer to the namespace, so long as it is bound to the correct URI. The host language may also define a default namespace for function calls, in which case function names in that namespace need not be prefixed at all. In many cases the default namespace will be let $para :=37, allowing a call on the let $para :=38 function (for example) to be written as let $para :=39 rather than let $para :=40; in this document, however, all example function calls are explicitly prefixed. The URIs of the namespaces and the conventional prefixes associated with them are:
Note: The above namespace URIs are not expected to change from one version of this document to another. The contents of these namespaces may be extended to allow additional functions (and errors, and serialization parameters) to be defined. 1.3 Function overloadingA function is uniquely defined by its name and arity (number of arguments); it is therefore not possible to have two different functions that have the same name and arity, but different types in their signature. That is, function overloading in this sense of the term is not permitted. Consequently, functions such as let $para :=78 which accept arguments of many different types have a signature that defines a very general argument type, in this case let $para :=79 which accepts any single item; supplying an inappropriate item (such as a function item) causes a dynamic error. Some functions on numeric types include the type let $para :=72 in their signature as an argument or result type. In this version of the specification, let $para :=72 has been redefined as a built-in union type representing the union of let $para :=82, let $para :=83, let $para :=26 (and thus automatically accepting types derived from these, including let $para :=85). Operators such as "+" may be overloaded: they map to different underlying functions depending on the dynamic types of the supplied operands. It is possible for two functions to have the same name provided they have different arity (number of arguments). For the functions defined in this specification, where two functions have the same name and different arity, they also have closely related behavior, so they are defined in the same section of this document. 1.4 Function signatures and descriptionsEach function (or group of functions having the same name) is defined in this specification using a standard proforma. The function name is a let $para :=86 as defined in [XML Schema Part 2: Datatypes Second Edition] and must adhere to its syntactic conventions. Following the precedent set by [XML Path Language (XPath) Version 1.0], function names are generally composed of English words separated by hyphens ("-"). Abbreviations are used only where there is a strong precedent in other programming languages (as with let $para :=87 and let $para :=88 for sine and cosine). If a function name contains a [XML Schema Part 2: Datatypes Second Edition] datatype name, it may have intercapitalized spelling and is used in the function name as such. An example is let $para :=89. The first section in the proforma is a short summary of what the function does. This is intended to be informative rather than normative. Each function is then defined by specifying its signature, which defines the types of the parameters and of the result value. Each function's signature is presented in a form like this: let $para :=90( let $para :=91 let $para :=71 let $para :=93, ...) let $para :=71 let $para :=95 In this notation, function-name, in bold-face, is the name of the function whose signature is being specified. If the function takes no parameters, then the name is followed by an empty parameter list: " let $para :=96"; otherwise, the name is followed by a parenthesized list of parameter declarations, in which each declaration specifies the static type of the parameter, in italics, and a descriptive, but non-normative, name. If there are two or more parameter declarations, they are separated by a comma. The let $para :=95, also in italics, specifies the static type of the value returned by the function. The dynamic type of the value returned by the function is the same as its static type or derived from the static type. All parameter types and return types are specified using the SequenceType notation defined in Section 2.5.4 SequenceType Syntax XP31. One function, let $para :=98, has a variable number of arguments (two or more). More strictly, there is an infinite set of functions having the name let $para :=98, with arity ranging from 2 to infinity. For this special case, a single function signature is given, with an ellipsis indicating an indefinite number of arguments. The next section in the proforma defines the semantics of the function as a set of rules. The order in which the rules appear is significant; they are to be applied in the order in which they are written. Error conditions, however, are generally listed in a separate section that follows the main rules, and take precedence over non-error rules except where otherwise stated. The principles outlined in Section 2.3.4 Errors and Optimization XP31 apply by default: to paraphrase, if the result of the function can be determined without evaluating all its arguments, then it is not necessary to evaluate the remaining arguments merely in order to determine whether any error conditions apply. Where the proforma includes sections headed Notes or Examples, these are non-normative. Rules for passing parameters to operators are described in the relevant sections of [XQuery 3.1: An XML Query Language] and [XML Path Language (XPath) 3.1]. For example, the rules for passing parameters to arithmetic operators are described in Section 3.5 Arithmetic Expressions XP31. Specifically, rules for parameters of type let $para :=00 and the empty sequence are specified in this section. As is customary, the parameter type name indicates that the function or operator accepts arguments of that type, or types derived from it, in that position. This is called subtype substitution (See Section 2.5.5 SequenceType Matching XP31). In addition, numeric type instances and instances of type let $para :=30 can be promoted to produce an argument of the required type. (See Section B.1 Type Promotion XP31).
Some functions accept a single value or the empty sequence as an argument and some may return a single value or the empty sequence. This is indicated in the function signature by following the parameter or return type name with a question mark: " let $para :=11", indicating that either a single value or the empty sequence must appear. See below. let $para :=90( let $para :=91 let $para :=71 let $para :=15) let $para :=71 let $para :=17 Note that this function signature is different from a signature in which the parameter is omitted. See, for example, the two signatures for let $para :=78. In the first signature, the parameter is omitted and the argument defaults to the context item, referred to as let $para :=19. In the second signature, the argument must be present but may be the empty sequence, written as let $para :=96. Some functions accept a sequence of zero or more values as an argument. This is indicated by following the name of the type of the items in the sequence with let $para :=68. The sequence may contain zero or more items of the named type. For example, the function below accepts a sequence of let $para :=26 and returns a let $para :=26 or the empty sequence. let $para :=24( let $para :=25 let $para :=71 let $para :=27) let $para :=71 let $para :=29 1.5 OptionsAs a matter of convention, a number of functions defined in this document take a parameter whose value is a map, defining options controlling the detail of how the function is evaluated. Maps are a new datatype introduced in XPath 3.1. For example, the function let $para :=30 has an options parameter allowing specification of whether the output is to be indented. A call might be written: fn:xml-to-json($input, map{'indent':true()}) [Definition] Functions that take an options parameter adopt common conventions on how the options are used. These are referred to as the option parameter conventions. These rules apply only to functions that explicitly refer to them. Where a function adopts the ·option parameter conventions·, the following rules apply:
1.6 Type SystemThe diagrams in this section show how nodes, functions, primitive simple types, and user defined types fit together into a type system. This type system comprises two distinct subsystems that both include the primitive atomic types. In the diagrams, connecting lines represent relationships between derived types and the types from which they are derived; the arrowheads point toward the type from which they are derived. The dashed line represents relationships not present in this diagram, but that appear in one of the other diagrams. Dotted lines represent additional relationships that follow an evident pattern. The information that appears in each diagram is recapitulated in tabular form. The let $para :=41, let $para :=42, let $para :=43 types, and let $para :=72 and both the let $para :=45 and let $para :=46 are special types in that these types are lists or unions rather than types derived by extension or restriction. 1.6.1 Item TypesThe first diagram and its corresponding table illustrate the relationship of various item types. Item types are used to characterize the various types of item that can appear in a sequence (nodes, atomic values, and functions), and they are therefore used in declaring the types of variables or the argument types and result types of functions. Item types in the data model form a directed graph, rather than a hierarchy or lattice: in the relationship defined by the let $para :=47 function, some types are derived from more than one other type. Examples include functions ( let $para :=48 is substitutable for let $para :=49 and also for let $para :=50), and union types ( let $para :=51 is substitutable for let $para :=52 and also for let $para :=53. In XDM, item types include node types, function types, and built-in atomic types. The diagram, which shows only hierarchic relationships, is therefore a simplification of the full model. In the table, each type whose name is indented is derived from the type whose name appears nearest above it with one less level of indentation. Item Type Hierarchyitem xs:anyAtomicType node attribute user-defined attribute typescomment document user-defined document typeselement user-defined element typesnamespace processing-instruction text function(*) array(*) map(*)1.6.2 Schema Type HierarchyThe next diagram and table illustrate the schema type subsystem, in which all types are derived from the distinguished type let $para :=54. Schema types include built-in types defined in the XML Schema specification, and user-defined types defined using mechanisms described in the XML Schema specification. Schema types define the permitted contents of nodes. The main categories are complex types, which define the permitted content of elements, and simple types, which can be used to constrain the values of both elements and attributes. In the table, each type whose name is indented is derived from the type whose name appears nearest above it with one less level of indentation. xs:anyType xs:anySimpleType xs:anyAtomicType list types xs:IDREFSxs:NMTOKENSxs:ENTITIESuser-defined list typesunion types xs:numericuser-defined union typescomplex types xs:untyped user-defined complex types1.6.3 Atomic Type HierarchyThe final diagram and table show all of the atomic types, including the primitive simple types and the built-in types derived from the primitive simple types. This includes all the built-in datatypes defined in [XML Schema Part 2: Datatypes Second Edition]. Atomic types are both item types and schema types, so the root type let $para :=34 may be found in both the previous diagrams. In the table, each type whose name is indented is derived from the type whose name appears nearest above it with one less level of indentation. xs:untypedAtomic xs:dateTime xs:dateTimeStamp xs:date xs:time xs:duration xs:yearMonthDuration xs:dayTimeDuration xs:float xs:double xs:decimal xs:integer xs:nonPositiveInteger xs:negativeInteger xs:long xs:int xs:short xs:byte xs:nonNegativeInteger xs:unsignedLong xs:unsignedInt xs:unsignedShort xs:unsignedBytexs:positiveInteger xs:gYearMonth xs:gYear xs:gMonthDay xs:gDay xs:gMonth xs:string xs:normalizedString xs:token xs:language xs:NMTOKEN xs:Name xs:NCName xs:ID xs:IDREF xs:ENTITY xs:boolean xs:base64Binary xs:hexBinary xs:anyURI xs:QName xs:NOTATION1.7 TerminologyThe terminology used to describe the functions and operators on types defined in [XML Schema Part 2: Datatypes Second Edition] is defined in the body of this specification. The terms defined in this section are used in building those definitions. Note: Following in the tradition of [XML Schema Part 2: Datatypes Second Edition], the terms type and datatype are used interchangeably. 1.7.1 Strings, characters, and codepointsThis document uses the terms let $para :=56, let $para :=57, and let $para :=58 with meanings that are normatively defined in [XQuery and XPath Data Model (XDM) 3.1], and which are paraphrased here for ease of reference: [Definition] A character is an instance of the CharXML production of [Extensible Markup Language (XML) 1.0 (Fifth Edition)]. Note: This definition excludes Unicode characters in the surrogate blocks as well as xFFFE and xFFFF, while including characters with codepoints greater than xFFFF which some programming languages treat as two characters. The valid characters are defined by their codepoints, and include some whose codepoints have not been assigned by the Unicode consortium to any character. [Definition] A string is a sequence of zero or more ·characters·, or equivalently, a value in the value space of the [Definition] A codepoint is an integer assigned to a ·character· by the Unicode consortium, or reserved for future assignment to a character. Note: The set of codepoints is thus wider than the set of characters. This specification spells "codepoint" as one word; the Unicode specification spells it as "code point". Equivalent terms found in other specifications are "character number" or "code position". See [Character Model for the World Wide Web 1.0: Fundamentals] Because these terms appear so frequently, they are hyperlinked to the definition only when there is a particular desire to draw the reader's attention to the definition; the absence of a hyperlink does not mean that the term is being used in some other sense. It is ·implementation-defined· which version of [The Unicode Standard] is supported, but it is recommended that the most recent version of Unicode be used. Unless explicitly stated, the let $para :=10 values returned by the functions in this document are not normalized in the sense of [Character Model for the World Wide Web 1.0: Fundamentals]. Notes: In functions that involve character counting such as let $para :=61, let $para :=62 and let $para :=63, what is counted is the number of XML ·characters· in the string (or equivalently, the number of Unicode codepoints). Some implementations may represent a codepoint above xFFFF using two 16-bit values known as a surrogate pair. A surrogate pair counts as one character, not two. 1.7.2 Namespaces and URIsThis document uses the phrase "namespace URI" to identify the concept identified in [Namespaces in XML] as "namespace name", and the phrase "local name" to identify the concept identified in [Namespaces in XML] as "local part". It also uses the term "expanded-QName" defined below. [Definition] An expanded-QName is a value in the value space of the The term URI is used as follows: [Definition] Within this specification, the term URI refers to Universal Resource Identifiers as defined in [RFC 3986] and extended in [RFC 3987] with a new name IRI. The term URI Reference, unless otherwise stated, refers to a string in the lexical space of the Note: Note that this means, in practice, that where this specification requires a "URI Reference", an IRI as defined in [RFC 3987] will be accepted, provided that other relevant specifications also permit an IRI. The term URI has been retained in preference to IRI to avoid introducing new names for concepts such as "Base URI" that are defined or referenced across the whole family of XML specifications. Note also that the definition of let $para :=30 is a wider definition than the definition in [RFC 3987]; for example it does not require non-ASCII characters to be escaped. 1.7.3 Conformance terminologyIn this specification:
[Definition] Where behavior is described as implementation-defined, variations between processors are permitted, but a conformant implementation must document the choices it has made. [Definition] Where behavior is described as implementation-dependent, variations between processors are permitted, and conformant implementations are not required to document the choices they have made. Note: Where this specification states that something is implementation-defined or implementation-dependent, it is open to host languages to place further constraints on the behavior. 1.7.4 Properties of functionsThis section is concerned with the question of whether two calls on a function, with the same arguments, may produce different results. [Definition] An execution scope is a sequence of calls to the function library during which certain aspects of the state are required to remain invariant. For example, two calls to let $para :=70 attributes, are in a separate execution scope). The following definition explains more precisely what it means for two function calls to return the same result: [Definition] Two values are defined to be identical if they contain the same number of items and the items are pairwise identical. Two items are identical if and only if one of the following conditions applies:
Some functions produce results that depend not only on their explicit arguments, but also on the static and dynamic context. [Definition] A function may have the property of being context-dependent: the result of such a function depends on the values of properties in the static and dynamic evaluation context as well as on the actual supplied arguments (if any). [Definition] A function that is not ·context-dependent· is called context-independent. A function that is context-dependent can be used as a named function reference, can be partially applied, and can be found using let $para :=77. The principle in such cases is that the static context used for the function evaluation is taken from the static context of the named function reference, partial function application, or the call on let $para :=77; and the dynamic context for the function evaluation is taken from the dynamic context of the evaluation of the named function reference, partial function application, or the call of let $para :=77. In effect, the static and dynamic part of the context thus act as part of the closure of the function item. Context-dependent functions fall into a number of categories:
The let $para :=77 function is a special case because it is potentially dependent on everything in the static and dynamic context. This is because the static and dynamic context of the call to let $para :=77 are used as the static and dynamic context of the function that let $para :=77 returns. [Definition] For a ·context-dependent· function, the parts of the context on which it depends are referred to as implicit arguments. [Definition] A function that is guaranteed to produce ·identical· results from repeated calls within a single ·execution scope· if the explicit and implicit arguments are identical is referred to as deterministic. [Definition] A function that is not ·deterministic· is referred to as nondeterministic. All functions defined in this specification are ·deterministic· unless otherwise stated. Exceptions include the following:
Where the results of a function are described as being (to a greater or lesser extent) ·implementation-defined· or ·implementation-dependent·, this does not by itself remove the requirement that the results should be deterministic: that is, that repeated calls with the same explicit and implicit arguments must return identical results. 2 AccessorsAccessors and their semantics are described in [XQuery and XPath Data Model (XDM) 3.1]. Some of these accessors are exposed to the user through the functions described below. Each of these functions has an arity-zero signature which is equivalent to the arity-one form, with the context item supplied as the implicit first argument. In addition, each of the arity-one functions accepts an empty sequence as the argument, in which case it generally delivers an empty sequence as the result: the exception is let $para :=78, which delivers a zero-length string.FunctionAccessorAcceptsReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)27 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)28node (optional) let $para :=36 (optional) op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)30 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)31node (optional) op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 (optional) let $para :=78 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)34item (optional) let $para :=10 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)36 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)37zero or more itemsa sequence of atomic values op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)38 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)39node (optional) let $para :=30 (optional) op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)41 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)42node (optional) let $para :=30 (optional) 2.1 fn:node-nameSummaryReturns the name of a node, as an let $para :=36.Signatures op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)27() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)27( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If let $para :=25 is the empty sequence, the empty sequence is returned. Otherwise, the function returns the result of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)56 accessor as defined in [XQuery and XPath Data Model (XDM) 3.1] (see Section 5.10 node-name Accessor DM31).Error Conditions The following errors may be raised when let $para :=25 is omitted:
For element and attribute nodes, the name of the node is returned as an let $para :=36, retaining the prefix, namespace URI, and local part. For processing instructions, the name of the node is returned as an let $para :=36 in which the prefix and namespace URI are absentDM31. For a namespace node, the function returns an empty sequence if the node represents the default namespace; otherwise it returns an let $para :=36 in which prefix and namespace URI are absentDM31 and the local part is the namespace prefix being bound. For all other kinds of node, the function returns the empty sequence. 2.2 fn:nilledSummaryReturns true for an element that is nilled. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)30() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)30( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the function returns the result of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)72 accessor as defined in [XQuery and XPath Data Model (XDM) 3.1] (see Section 5.8 nilled Accessor DM31).Error Conditions The following errors may be raised when let $para :=25 is omitted:
If let $para :=25 is not an element node, the function returns the empty sequence. If let $para :=25 is an untyped element node, the function returns false. In practice, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 only for an element node that has the attribute op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)77 and that is successfully validated against a schema that defines the element to be nillable; the detailed rules, however, are defined in [XQuery and XPath Data Model (XDM) 3.1]. 2.3 fn:stringSummaryReturns the value of let $para :=25 represented as an let $para :=10.Signatures let $para :=78() let $para :=71 let $para :=10 let $para :=78( let $para :=25 let $para :=71 let $para :=79) let $para :=71 let $para :=10Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIn the zero-argument version of the function, let $para :=25 defaults to the context item. That is, calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)90 is equivalent to calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)91. If let $para :=25 is the empty sequence, the function returns the zero-length string. If $arg is a node, the function returns the string value of the node, as obtained using the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)93 accessor defined in [XQuery and XPath Data Model (XDM) 3.1] (see Section 5.12 string-value Accessor DM31). If $arg is an atomic value, the function returns the result of the expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)94 (see 19 Casting). In all other cases, a dynamic error occurs (see below). Error ConditionsA dynamic error is raised [err:XPDY0002]XP31 by the zero-argument version of the function if the context item is absentDM31. A type error is raised [err:FOTY0014] if let $para :=25 is a function item (this includes maps and arrays).Notes Every node has a string value, even an element with element-only content (which has no typed value). Moreover, casting an atomic value to a string always succeeds. Functions, maps, and arrays have no string value, so these are the only arguments that satisfy the type signature but cause failure. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)96 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)97. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)98 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)99. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)00 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)01. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)02 raises error op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)03. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)04 raises error op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)05. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)06 raises error op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)05. let $para := The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)08 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)09. 2.4 fn:dataSummaryReturns the result of atomizing a sequence. This process flattens arrays, and replaces nodes by their typed values. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)36() let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)36( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The result of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)36 is the sequence of atomic values produced by applying the following rules to each item in let $para :=25:
A type error is raised [err:FOTY0012] if an item in the sequence let $para :=25 is a node that does not have a typed value. A type error is raised [err:FOTY0013] if an item in the sequence let $para :=25 is a function item other than an array. A dynamic error is raised if let $para :=25 is omitted and the context item is absentDM31.Notes The process of applying the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)36 function to a sequence is referred to as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)28. In many cases an explicit call on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)36 is not required, because atomization is invoked implicitly when a node or sequence of nodes is supplied in a context where an atomic value or sequence of atomic values is required. The result of atomizing an empty sequence is an empty sequence. The result of atomizing an empty array is an empty sequence. ExamplesThe expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)30 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)31. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)32 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)33. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)34 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)35. let $para := The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)36 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)37. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)38 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)39. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)40 raises error op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)41. 2.5 fn:base-uriSummaryReturns the base URI of a node. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)38() let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)38( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe zero-argument version of the function returns the base URI of the context node: it is equivalent to calling op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)51. The single-argument version of the function behaves as follows:
Note: As explained in XDM, document, element and processing-instruction nodes have a base-uri property which may be empty. The base-uri property for all other node kinds is the empty sequence. The dm:base-uri accessor returns the base-uri property of a node if it exists and is non-empty; otherwise it returns the result of applying the dm:base-uri accessor to its parent, recursively. If the node does not have a parent, or if the recursive ascent up the ancestor chain encounters a parentless node whose base-uri property is empty, the empty sequence is returned. In the case of namespace nodes, however, the result is always an empty sequence — it does not depend on the base URI of the parent element.See also op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)08.Error Conditions The following errors may be raised when let $para :=25 is omitted:
2.6 fn:document-uriSummaryReturns the URI of a resource where a document can be found, if available. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)41() let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)41( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If let $para :=25 is the empty sequence, the function returns the empty sequence. If let $para :=25 is not a document node, the function returns the empty sequence. Otherwise, the function returns the value of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)42 accessor applied to let $para :=25, as defined in [XQuery and XPath Data Model (XDM) 3.1] (See Section 6.1.2 Accessors DM31).Error Conditions The following errors may be raised when let $para :=25 is omitted:
In the case of a document node op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)72 returned by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 function, or a document node at the root of a tree containing a node returned by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10 function, it will always be true that either op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)75 returns the empty sequence, or that the following expression is true: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)76 is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)72. It is ·implementation-defined· whether this guarantee also holds for document nodes obtained by other means, for example a document node passed as the initial context node of a query or transformation. 3 Errors and diagnostics3.1 Raising errorsIn this document, as well as in [XQuery 3.1: An XML Query Language] and [XML Path Language (XPath) 3.1], the phrase "an error is raised" is used. Raising an error is equivalent to calling the op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78 function defined in this section with the provided error code. Except where otherwise specified, errors defined in this specification are dynamic errors. Some errors, however, are classified as type errors. Type errors are typically used where the presence of the error can be inferred from knowledge of the type of the actual arguments to a function, for example with a call such as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)79. Host languages may allow type errors to be reported statically if they are discovered during static analysis. When function specifications indicate that an error is to be raised, the notation "[error code]". os used to specify an error code. Each error defined in this document is identified by an let $para :=36 that is in the let $para :=60 namespace, represented in this document by the let $para :=61 prefix. It is this let $para :=36 that is actually passed as an argument to the op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78 function. Calling this function raises an error. For a more detailed treatment of error handing, see Section 2.3.3 Handling Dynamic Errors XP31. The op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78 function is a general function that may be called as above but may also be called from [XQuery 3.1: An XML Query Language] or [XML Path Language (XPath) 3.1] applications with, for example, an let $para :=36 argument. 3.1.1 fn:errorSummaryCalling the op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78 function raises an application-defined error.Signatures op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78() let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)90 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78( op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)92 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)90 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78( op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)92 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).01 let $para :=71 let $para :=10) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)90 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78( op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)92 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).01 let $para :=71 let $para :=10, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).13 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)90Properties This function is ·nondeterministic·, ·context-independent·, and ·focus-independent·. RulesThis function never returns a value. Instead it always raises an error. The effect of the error is identical to the effect of dynamic errors raised implicitly, for example when an incorrect argument is supplied to a function. The parameters to the op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78 function supply information that is associated with the error condition and that is made available to a caller that asks for information about the error. The error may be caught either by the host language (using a try/catch construct in XSLT or XQuery, for example), or by the calling application or external processing environment. The way in which error information is returned to the external processing environment is ·implementation-dependent·. There are three pieces of information that may be associated with an error:
This function always raises a dynamic error. By default, it raises [err:FOER0000] NotesThe value of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).01 parameter may need to be localized. The type "none" is a special type defined in [XQuery 1.0 and XPath 2.0 Formal Semantics] and is not available to the user. It indicates that the function never returns and ensures that it has the correct static type. Any QName may be used as an error code; there are no reserved names or namespaces. The error is always classified as a dynamic error, even if the error code used is one that is normally used for static errors or type errors. ExamplesThe expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).33 raises error fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).34. (This returns the URI fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).35 (or the corresponding let $para :=36) to the external processing environment, unless the error is caught using a try/catch construct in the host language.) The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).37 raises error fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).38. (This returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).39 and the let $para :=10 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).41 (or the corresponding let $para :=36) to the external processing environment, unless the error is caught using a try/catch construct in the host language.) 3.2 Diagnostic tracing3.2.1 fn:traceSummaryProvides an execution trace intended to be used in debugging queries. Signaturesfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).43( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).43( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).53 let $para :=71 let $para :=10) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the value of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44, unchanged. In addition, the values of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44, converted to an let $para :=10, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).53 (if supplied) may be directed to a trace data set. The destination of the trace output is ·implementation-defined·. The format of the trace output is ·implementation-dependent·. The ordering of output from calls of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).43 function is ·implementation-dependent·.Notes Sometimes there is a need to output trace information unrelated to a specific value. In such cases it can be useful to set fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 to an empty string or an empty sequence, and to compute the value of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).53 argument: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).65.Examples Consider a situation in which a user wants to investigate the actual value passed to a function. Assume that in a particular execution, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).66 is an let $para :=82 with value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).68. Writing fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).69 will put the strings fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).70 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).71 in the trace data set in implementation dependent order. 4 Functions and operators on numericsThis section specifies arithmetic operators on the numeric datatypes defined in [XML Schema Part 2: Datatypes Second Edition]. 4.1 Numeric typesThe operators described in this section are defined on the following atomic types. Each type whose name is indented is derived from the type whose name appears nearest above with one less level of indentation. xs:decimal xs:integerxs:float xs:doubleThey also apply to types derived by restriction from the above types. The type let $para :=72 is defined as a union type whose member types are (in order) let $para :=26, let $para :=83, and let $para :=82. This type is implicitly imported into the static context, so it can also be used in defining the signature of user-written functions. Apart from the fact that it is implicitly imported, it behaves exactly like a user-defined type with the same definition. This means, for example:
Note: This specification uses [IEEE 754-2008] arithmetic for let $para :=83 and let $para :=26 values. One consequence of this is that some operations result in the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 (not-a number), which has the unusual property that it is not equal to itself. Another consequence is that some operations return the value negative zero. This differs from [XML Schema Part 2: Datatypes Second Edition] which defines fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 as being equal to itself and defines only a single zero in the value space. The text accompanying several functions defines behavior for both positive and negative zero inputs and outputs in the interest of alignment with [IEEE 754-2008]. A conformant implementation must respect these semantics. In consequence, the expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92 (which is actually a unary minus operator applied to an let $para :=26 value) will always return negative zero: see 4.2.8 op:numeric-unary-minus. As a concession to implementations that rely on implementations of XSD 1.0, however, when casting from string to double the lexical form fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).94 may be converted to positive zero, though negative zero is recommended. XML Schema 1.1 introduces support for positive and negative zero as distinct values, and also uses the [IEEE 754-2008] semantics for comparisons involving fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. 4.2 Arithmetic operators on numeric valuesThe following functions define the semantics of arithmetic operators defined in [XQuery 3.1: An XML Query Language] and [XML Path Language (XPath) 3.1] on these numeric types. OperatorMeaningfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).96Addition fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).97Subtraction let $para :=69Multiplication fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).99Division 1º 2º 3º 4º ...00Integer division 1º 2º 3º 4º ...01Modulus 1º 2º 3º 4º ...02Unary plus 1º 2º 3º 4º ...03Unary minus (negation) The parameters and return types for the above operators are in most cases declared to be of type fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).99, which returns an let $para :=82 if called with two let $para :=85 operands, and 1º 2º 3º 4º ...00 which always returns an let $para :=85. If the two operands of an arithmetic expression are not of the same type, subtype substitution and numeric type promotion are used to obtain two operands of the same type. Section B.1 Type Promotion XP31 and Section B.2 Operator Mapping XP31 describe the semantics of these operations in detail. The result type of operations depends on their argument datatypes and is defined in the following table: OperatorReturns1º 2º 3º 4º ...14 let $para :=85 (except for 1º 2º 3º 4º ...16, which returns let $para :=82) 1º 2º 3º 4º ...18 let $para :=82 1º 2º 3º 4º ...20 let $para :=83 1º 2º 3º 4º ...22 let $para :=26 1º 2º 3º 4º ...24 let $para :=85 1º 2º 3º 4º ...26 let $para :=82 1º 2º 3º 4º ...28 let $para :=83 1º 2º 3º 4º ...30 let $para :=26 These rules define any operation on any pair of arithmetic types. Consider the following example: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double) For this operation, 1º 2º 3º 4º ...32 must be converted to let $para :=26. This can be done, since by the rules above: 1º 2º 3º 4º ...32 can be substituted for let $para :=85, let $para :=85 can be substituted for let $para :=82, let $para :=82 can be promoted to let $para :=26. As far as possible, the promotions should be done in a single step. Specifically, when an let $para :=82 is promoted to an let $para :=26, it should not be converted to an let $para :=83 and then to let $para :=26, as this risks loss of precision. As another example, a user may define 1º 2º 3º 4º ...44 as a derived type of let $para :=85 with a minimum value of 20 and a maximum value of 100. They may then derive 1º 2º 3º 4º ...46 using an enumeration to restrict the permitted set of values to, say, 36, 48 and 60. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer) 1º 2º 3º 4º ...46 can be substituted for its base type 1º 2º 3º 4º ...44 and 1º 2º 3º 4º ...44 can be substituted for its base type let $para :=85. The basic rules for addition, subtraction, and multiplication of ordinary numbers are not set out in this specification; they are taken as given. In the case of let $para :=26 and let $para :=83 the rules are as defined in [IEEE 754-2008]. The rules for handling division and modulus operations, as well as the rules for handling special values such as infinity and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, and exception conditions such as overflow and underflow, are described more explicitly since they are not necessarily obvious. On overflow and underflow situations during arithmetic operations conforming implementations must behave as follows:
The functions fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).96, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).97, let $para :=69, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).99, 1º 2º 3º 4º ...00 and 1º 2º 3º 4º ...01 are each defined for pairs of numeric operands, each of which has the same type: let $para :=85, let $para :=82, let $para :=83, or let $para :=26. The functions 1º 2º 3º 4º ...02 and 1º 2º 3º 4º ...03 are defined for a single operand whose type is one of those same numeric types. For let $para :=83 and let $para :=26 arguments, if either argument is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. For let $para :=82 values, let N be the number of digits of precision supported by the implementation, and let M ( 1º 2º 3º 4º ...85) be the minimum limit on the number of digits required for conformance (18 digits for XSD 1.0, 16 digits for XSD 1.1). Then for addition, subtraction, and multiplication operations, the returned result should be accurate to N digits of precision, and for division and modulus operations, the returned result should be accurate to at least M digits of precision. The actual precision is ·implementation-defined·. If the number of digits in the mathematical result exceeds the number of digits that the implementation retains for that operation, the result is truncated or rounded in an ·implementation-defined· manner. Note: This Recommendation does not specify whether let $para :=82 operations are fixed point or floating point. In an implementation using floating point it is possible for very simple operations to require more digits of precision than are available; for example adding 1º 2º 3º 4º ...87 to 1º 2º 3º 4º ...88 requires 200 digits of precision for an accurate representation of the result. The [IEEE 754-2008] specification also describes handling of two exception conditions called 1º 2º 3º 4º ...89 and 1º 2º 3º 4º ...90. The IEEE 1º 2º 3º 4º ...89 exception is raised not only by a direct attempt to divide by zero, but also by operations such as 1º 2º 3º 4º ...92. The IEEE 1º 2º 3º 4º ...90 exception is raised by attempts to call a function with an argument that is outside the function's domain (for example, 1º 2º 3º 4º ...94 or 1º 2º 3º 4º ...95). Although IEEE defines these as exceptions, it also defines "default non-stop exception handling" in which the operation returns a defined result, typically positive or negative infinity, or NaN. With this function library, these IEEE exceptions do not cause a dynamic error at the application level; rather they result in the relevant function or operator returning the defined non-error result. The underlying IEEE exception may be notified to the application or to the user by some ·implementation-defined· warning condition, but the observable effect on an application using the functions and operators defined in this specification is simply to return the defined result (typically -INF, +INF, or NaN) with no error. The [IEEE 754-2008] specification distinguishes two NaN values, a quiet NaN and a signaling NaN. These two values are not distinguishable in the XDM model: the value spaces of let $para :=83 and let $para :=26 each include only a single fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 value. This does not prevent the implementation distinguishing them internally, and triggering different ·implementation-defined· warning conditions, but such distinctions do not affect the observable behavior of an application using the functions and operators defined in this specification. 4.2.1 op:numeric-addSummaryReturns the arithmetic sum of its operands: ( 1º 2º 3º 4º ...99).Operator Mapping Defines the semantics of the "+" operator when applied to two numeric values Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).96( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. NotesFor let $para :=83 or let $para :=26 values, if one of the operands is a zero or a finite number and the other is 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57, 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57 is returned. If both operands are 1º 2º 3º 4º ...56, 1º 2º 3º 4º ...56 is returned. If both operands are 1º 2º 3º 4º ...57, 1º 2º 3º 4º ...57 is returned. If one of the operands is 1º 2º 3º 4º ...56 and the other is 1º 2º 3º 4º ...57, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned. 4.2.2 op:numeric-subtractSummaryReturns the arithmetic difference of its operands: ( Primo Secondo Terzo Quarto Quinto ...22).Operator Mapping Defines the semantics of the "-" operator when applied to two numeric values. Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).97( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. NotesFor let $para :=83 or let $para :=26 values, if one of the operands is a zero or a finite number and the other is 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57, an infinity of the appropriate sign is returned. If both operands are 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned. If one of the operands is 1º 2º 3º 4º ...56 and the other is 1º 2º 3º 4º ...57, an infinity of the appropriate sign is returned. 4.2.3 op:numeric-multiplySummaryReturns the arithmetic product of its operands: ( Primo Secondo Terzo Quarto Quinto ...41).Operator Mapping Defines the semantics of the "*" operator when applied to two numeric values. Signaturelet $para :=69( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. NotesFor let $para :=83 or let $para :=26 values, if one of the operands is a zero and the other is an infinity, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned. If one of the operands is a non-zero number and the other is an infinity, an infinity with the appropriate sign is returned. 4.2.4 op:numeric-divideSummaryReturns the arithmetic quotient of its operands: ( Primo Secondo Terzo Quarto Quinto ...54).Operator Mapping Defines the semantics of the "div" operator when applied to two numeric values. Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).99( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. As a special case, if the types of both let $para :=70 and let $para :=73 are let $para :=85, then the return type is let $para :=82.Error Conditions A dynamic error is raised [err:FOAR0001] for let $para :=82 and let $para :=85 operands, if the divisor is (positive or negative) zero.Notes For let $para :=83 and let $para :=26 operands, floating point division is performed as specified in [IEEE 754-2008]. A positive number divided by positive zero returns 1º 2º 3º 4º ...56. A negative number divided by positive zero returns 1º 2º 3º 4º ...57. Division by negative zero returns 1º 2º 3º 4º ...57 and 1º 2º 3º 4º ...56, respectively. Positive or negative zero divided by positive or negative zero returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. Also, 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57 divided by 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. 4.2.5 op:numeric-integer-divideSummaryPerforms an integer division. Operator MappingDefines the semantics of the "idiv" operator when applied to two numeric values. Signature1º 2º 3º 4º ...00( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 let $para :=85Rules General rules: see 4.2 Arithmetic operators on numeric values. If let $para :=73 is 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57, and let $para :=70 is not 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57, then the result is zero. Otherwise, subject to limits of precision and overflow/underflow conditions, the result is the largest (furthest from zero) let $para :=85 value Primo Secondo Terzo Quarto Quinto ...98 such that the following expression is true: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0). Note: The second term in this condition ensures that the result has the correct sign. The implementation may adopt a different algorithm provided that it is equivalent to this formulation in all cases where ·implementation-dependent· or ·implementation-defined· behavior does not affect the outcome, for example, the implementation-defined precision of the result of let $para :=82 division.Error Conditions A dynamic error is raised [err:FOAR0001] if the divisor is (positive or negative) zero. A dynamic error is raised [err:FOAR0002] if either operand is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 or if let $para :=70 is 1º 2º 3º 4º ...56 or 1º 2º 3º 4º ...57.Notes Except in situations involving errors, loss of precision, or overflow/underflow, the result of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);04 is the same as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);05. The semantics of this function are different from integer division as defined in programming languages such as Java and C++. ExamplesThe expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);06 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);08 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);09. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);10 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);09. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);12 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);14 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);16 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);09. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);18 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);20 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);22 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);23. 4.2.6 op:numeric-modSummaryReturns the remainder resulting from dividing let $para :=70, the dividend, by let $para :=73, the divisor.Operator Mapping Defines the semantics of the "mod" operator when applied to two numeric values. Signature1º 2º 3º 4º ...01( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. The operation declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);35 for operands that are let $para :=85 or let $para :=82, or types derived from them, produces a result such that declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);38 is equal to declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);39 and the magnitude of the result is always less than the magnitude of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);40. This identity holds even in the special case that the dividend is the negative integer of largest possible magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this rule that the sign of the result is the sign of the dividend. For let $para :=83 and let $para :=26 operands the following rules apply:
A dynamic error is raised [err:FOAR0001] for let $para :=85 and let $para :=82 operands, if let $para :=73 is zero.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);52 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);54 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);56 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);57. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);58 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);59. 4.2.7 op:numeric-unary-plusSummaryReturns its operand with the sign unchanged: ( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);60).Operator Mapping Defines the semantics of the unary "+" operator applied to a numeric value. Signature1º 2º 3º 4º ...02( let $para :=25 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. The returned value is equal to let $para :=25, and is an instance of let $para :=85, let $para :=82, let $para :=26, or let $para :=83 depending on the type of let $para :=25.Notes Because function conversion rules are applied in the normal way, the unary declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);73 operator can be used to force conversion of an untyped node to a number: the result of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);74 is the same as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);75 if the type of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);76 is let $para :=00. 4.2.8 op:numeric-unary-minusSummaryReturns its operand with the sign reversed: ( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);78).Operator Mapping Defines the semantics of the unary "-" operator when applied to a numeric value. Signature1º 2º 3º 4º ...03( let $para :=25 let $para :=71 let $para :=72) let $para :=71 let $para :=72Rules General rules: see 4.2 Arithmetic operators on numeric values. The returned value is an instance of let $para :=85, let $para :=82, let $para :=26, or let $para :=83 depending on the type of let $para :=25. For let $para :=85 and let $para :=82 arguments, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19 and 1º 2º 3º 4º ...66 return declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19 and 1º 2º 3º 4º ...66, respectively. For let $para :=83 and let $para :=26 arguments, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, 1º 2º 3º 4º ...60 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'01 and vice versa. 1º 2º 3º 4º ...56 returns 1º 2º 3º 4º ...57. 1º 2º 3º 4º ...57 returns 1º 2º 3º 4º ...56. 4.3 Comparison operators on numeric valuesThis specification defines the following comparison operators on numeric values. Comparisons take two arguments of the same type. If the arguments are of different types, one argument is promoted to the type of the other as described above in 4.2 Arithmetic operators on numeric values. Each comparison operator returns a boolean value. If either, or both, operands are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 is returned.FunctionMeaning let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'08Returns true if and only if the value of let $para :=70 is equal to the value of let $para :=73. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'11Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if let $para :=70 is numerically less than let $para :=73. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'15Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if let $para :=70 is numerically greater than let $para :=73. 4.3.1 op:numeric-equalSummaryReturns true if and only if the value of let $para :=70 is equal to the value of let $para :=73.Operator Mapping Defines the semantics of the "eq" operator when applied to two numeric values, and is also used in defining the semantics of "ne", "le" and "ge". Signaturelet $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'08( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules General rules: see 4.2 Arithmetic operators on numeric values and 4.3 Comparison operators on numeric values. For let $para :=83 and let $para :=26 values, positive zero and negative zero compare equal. 1º 2º 3º 4º ...56 equals 1º 2º 3º 4º ...56, and 1º 2º 3º 4º ...57 equals 1º 2º 3º 4º ...57. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 does not equal itself. 4.3.2 op:numeric-less-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if let $para :=70 is numerically less than let $para :=73.Operator Mapping Defines the semantics of the "lt" operator when applied to two numeric values, and is also used in defining the semantics of "le". Signaturelet $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'11( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules General rules: see 4.2 Arithmetic operators on numeric values and 4.3 Comparison operators on numeric values. For let $para :=83 and let $para :=26 values, positive infinity is greater than all other non- fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 values; negative infinity is less than all other non- fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 values. If let $para :=70 or let $para :=73 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 4.3.3 op:numeric-greater-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if let $para :=70 is numerically greater than let $para :=73.Operator Mapping Defines the semantics of the "gt" operator when applied to two numeric values, and is also used in defining the semantics of "ge". Signaturelet $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'15( let $para :=70 let $para :=71 let $para :=72, let $para :=73 let $para :=71 let $para :=72) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function call let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'69 is defined to return the same result as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'70 4.4 Functions on numeric valuesThe following functions are defined on numeric types. Each function returns a value of the same type as the type of its argument.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'73Returns the absolute value of let $para :=25. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'78Rounds let $para :=25 upwards to a whole number. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'80Rounds let $para :=25 downwards to a whole number. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'82Rounds a value to a specified number of decimal places, rounding upwards if two such values are equally near. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'83Rounds a value to a specified number of decimal places, rounding to make the last digit even if two such values are equally near. Note: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'82 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'83 produce the same result in all cases except when the argument is exactly midway between two values with the required precision. Other ways of rounding midway values can be achieved as follows:
4.4.1 fn:absSummaryReturns the absolute value of let $para :=25.Signature let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'73( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesGeneral rules: see 4.4 Functions on numeric values. If let $para :=25 is negative the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'97, otherwise it returns let $para :=25. For the four types let $para :=83, let $para :=26, let $para :=82 and let $para :=85, it is guaranteed that if the type of let $para :=25 is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if let $para :=25 is an instance of let $para :=005 then the value of let $para :=25 may be returned unchanged. For let $para :=83 and let $para :=26 arguments, if the argument is positive zero or negative zero, then positive zero is returned. If the argument is positive or negative infinity, positive infinity is returned.Examples The expression let $para :=009 returns let $para :=010. The expression let $para :=011 returns let $para :=010. 4.4.2 fn:ceilingSummaryRounds let $para :=25 upwards to a whole number.Signature let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'78( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesGeneral rules: see 4.4 Functions on numeric values. The function returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of let $para :=25. For the four types let $para :=83, let $para :=26, let $para :=82 and let $para :=85, it is guaranteed that if the type of let $para :=25 is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if let $para :=25 is an instance of let $para :=82 then the result may be an instance of let $para :=85. For let $para :=83 and let $para :=26 arguments, if the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned. If the argument is less than zero and greater than -1, negative zero is returned.Examples The expression let $para :=031 returns let $para :=032. The expression let $para :=033 returns let $para :=034. 4.4.3 fn:floorSummaryRounds let $para :=25 downwards to a whole number.Signature let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'80( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesGeneral rules: see 4.4 Functions on numeric values. The function returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of let $para :=25. For the four types let $para :=83, let $para :=26, let $para :=82 and let $para :=85, it is guaranteed that if the type of let $para :=25 is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if let $para :=25 is an instance of let $para :=82 then the result may be an instance of let $para :=85. For let $para :=83 and let $para :=26 arguments, if the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned.Examples The expression let $para :=053 returns let $para :=054. The expression let $para :=055 returns let $para :=056. 4.4.4 fn:roundSummaryRounds a value to a specified number of decimal places, rounding upwards if two such values are equally near. Signatureslet $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'82( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'82( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93, let $para :=067 let $para :=71 let $para :=85) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesGeneral rules: see 4.4 Functions on numeric values. The function returns the nearest (that is, numerically closest) value to let $para :=25 that is a multiple of ten to the power of minus let $para :=067. If two such values are equally near (for example, if the fractional part in let $para :=25 is exactly .5), the function returns the one that is closest to positive infinity. For the four types let $para :=83, let $para :=26, let $para :=82 and let $para :=85, it is guaranteed that if the type of let $para :=25 is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if let $para :=25 is an instance of let $para :=82 and let $para :=067 is less than one, then the result may be an instance of let $para :=85. The single-argument version of this function produces the same result as the two-argument version with let $para :=084 (that is, it rounds to a whole number). When let $para :=25 is of type let $para :=83 and let $para :=26:
This function is typically used with a non-zero let $para :=067 in financial applications where the argument is of type let $para :=82. For arguments of type let $para :=83 and let $para :=26 the results may be counter-intuitive. For example, consider let $para :=101. The result is not 35.43, as might be expected, but 35.42. This is because the let $para :=26 written as 35.425e0 has an exact value equal to 35.42499999999..., which is closer to 35.42 than to 35.43.Examples The expression let $para :=103 returns let $para :=104. The expression let $para :=105 returns let $para :=106. The expression let $para :=107 returns let $para :=108. (Not the possible alternative, let $para :=109). The expression let $para :=110 returns let $para :=111. The expression let $para :=112 returns let $para :=113. The expression let $para :=114 returns let $para :=115. 4.4.5 fn:round-half-to-evenSummaryRounds a value to a specified number of decimal places, rounding to make the last digit even if two such values are equally near. Signatureslet $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'83( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'83( let $para :=25 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93, let $para :=067 let $para :=71 let $para :=85) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesGeneral rules: see 4.4 Functions on numeric values. The function returns the nearest (that is, numerically closest) value to let $para :=25 that is a multiple of ten to the power of minus let $para :=067. If two such values are equally near (e.g. if the fractional part in let $para :=25 is exactly .500...), the function returns the one whose least significant digit is even. For the four types let $para :=83, let $para :=26, let $para :=82 and let $para :=85, it is guaranteed that if the type of let $para :=25 is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if let $para :=25 is an instance of let $para :=82 and let $para :=067 is less than one, then the result may be an instance of let $para :=85. The first signature of this function produces the same result as the second signature with let $para :=084. For arguments of type let $para :=83 and let $para :=26:
This function is typically used in financial applications where the argument is of type let $para :=82. For arguments of type let $para :=83 and let $para :=26 the results may be counter-intuitive. For example, consider let $para :=156. The result is not 150.02 as might be expected, but 150.01. This is because the conversion of the let $para :=83 value represented by the literal 150.015 to an let $para :=82 produces the let $para :=82 value 150.014999389..., which is closer to 150.01 than to 150.02.Examples The expression let $para :=160 returns 1º 2º 3º 4º ...66. The expression let $para :=162 returns let $para :=106. The expression let $para :=164 returns let $para :=106. The expression let $para :=166 returns let $para :=167. The expression let $para :=168 returns let $para :=169. The expression let $para :=170 returns let $para :=171. 4.5 Parsing numbersIt is possible to convert strings to values of type let $para :=85, let $para :=83, let $para :=82, or let $para :=26 using the constructor functions described in 18 Constructor functions or using let $para :=176 expressions as described in 19 Casting. In addition the let $para :=177 function is available to convert strings to values of type let $para :=26. It differs from the let $para :=26 constructor function in that any value outside the lexical space of the let $para :=26 datatype is converted to the let $para :=26 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.FunctionMeaning let $para :=177Returns the value indicated by let $para :=25 or, if let $para :=25 is not specified, the context item after atomization, converted to an let $para :=26. 4.5.1 fn:numberSummaryReturns the value indicated by let $para :=25 or, if let $para :=25 is not specified, the context item after atomization, converted to an let $para :=26.Signatures let $para :=177() let $para :=71 let $para :=26 let $para :=177( let $para :=25 let $para :=71 let $para :=196) let $para :=71 let $para :=26Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesCalling the zero-argument version of the function is defined to give the same result as calling the single-argument version with the context item ( let $para :=19). That is, let $para :=200 is equivalent to let $para :=201, as defined by the rules that follow. If let $para :=25 is the empty sequence or if let $para :=25 cannot be converted to an let $para :=26, the let $para :=26 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned. Otherwise, let $para :=25 is converted to an let $para :=26 following the rules of 19.1.2.2 Casting to xs:double. If the conversion to let $para :=26 fails, the let $para :=26 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned.Error Conditions A dynamic error is raised [err:XPDY0002]XP31 if let $para :=25 is omitted and the context item is absentDM31. As a consequence of the rules given above, a type error occurs if the context item cannot be atomized, or if the result of atomizing the context item is a sequence containing more than one atomic value. NotesXSD 1.1 allows the string let $para :=27 as a representation of positive infinity; XSD 1.0 does not. It is ·implementation-defined· whether XSD 1.1 is supported. Generally let $para :=177 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 rather than raising a dynamic error if the argument cannot be converted to let $para :=26. However, a type error is raised in the usual way if the supplied argument cannot be atomized or if the result of atomization does not match the required argument type.Examples The expression let $para :=217 returns let $para :=218. The expression let $para :=219 returns let $para :=220. Assume that the context item is the let $para :=10 value " let $para :=222". Then let $para :=200 returns let $para :=224. 4.6 Formatting integersFunctionMeaninglet $para :=225Formats an integer according to a given picture string, using the conventions of a given natural language if specified. 4.6.1 fn:format-integerSummaryFormats an integer according to a given picture string, using the conventions of a given natural language if specified. Signatureslet $para :=225( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 let $para :=229, let $para :=230 let $para :=71 let $para :=10) let $para :=71 let $para :=10 let $para :=225( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 let $para :=229, let $para :=230 let $para :=71 let $para :=10, let $para :=242 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on default language. The three-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 is an empty sequence, the function returns a zero-length string. In all other cases, the let $para :=230 argument describes the format in which fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 is output. The rules that follow describe how non-negative numbers are output. If the value of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 is negative, the rules below are applied to the absolute value of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44, and a minus sign is prepended to the result. The value of let $para :=230 consists of a primary format token, optionally followed by a format modifier. The primary format token is always present and must not be zero-length. If the string contains one or more semicolons then everything that precedes the last semicolon is taken as the primary format token and everything that follows is taken as the format modifier; if the string contains no semicolon then the entire picture is taken as the primary format token, and the format modifier is taken to be absent (which is equivalent to supplying a zero-length string). The primary format token is classified as one of the following:
For all format tokens other than a decimal-digit-pattern, there may be ·implementation-defined· lower and upper bounds on the range of numbers that can be formatted using this format token; indeed, for some numbering sequences there may be intrinsic limits. For example, the format token let $para :=285 (circled digit one, ①) has a range imposed by the Unicode character repertoire — zero to 20 in Unicode versions prior to 3.2, or zero to 50 in subsequent versions. For the numbering sequences described above any upper bound imposed by the implementation must not be less than 1000 (one thousand) and any lower bound must not be greater than 1. Numbers that fall outside this range must be formatted using the format token declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The above expansions of numbering sequences for format tokens such as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);39 and let $para :=274 are indicative but not prescriptive. There are various conventions in use for how alphabetic sequences continue when the alphabet is exhausted, and differing conventions for how roman numerals are written (for example, let $para :=289 versus let $para :=290 as the representation of the number 4). Sometimes alphabetic sequences are used that omit letters such as let $para :=274 and let $para :=292. This specification does not prescribe the detail of any sequence other than those sequences consisting entirely of decimal digits. Many numbering sequences are language-sensitive. This applies especially to the sequence selected by the tokens let $para :=278, let $para :=280 and let $para :=282. It also applies to other sequences, for example different languages using the Cyrillic alphabet use different sequences of characters, each starting with the letter #x410 (Cyrillic capital letter A). In such cases, the let $para :=242 argument specifies which language's conventions are to be used. If the argument is specified, the value should be either an empty sequence or a value that would be valid for the let $para :=297 attribute (see [Extensible Markup Language (XML) 1.0 (Fifth Edition)]). Note that this permits the identification of sublanguages based on country codes (from ISO 3166-1) as well as identification of dialects and regions within a country. The set of languages for which numbering is supported is ·implementation-defined·. If the let $para :=242 argument is absent, or is set to an empty sequence, or is invalid, or is not a language supported by the implementation, then the number is formatted using the default language from the dynamic context. The format modifier must be a string that matches the regular expression let $para :=299. That is, if it is present it must consist of one or more of the following, in order:
If the let $para :=292 modifier is present, this indicates a request to output ordinal numbers rather than cardinal numbers. For example, in English, when used with the format token declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13, this outputs the sequence let $para :=306, and when used with the format token let $para :=278 outputs the sequence let $para :=308. The string of characters between the parentheses, if present, is used to select between other possible variations of cardinal or ordinal numbering sequences. The interpretation of this string is ·implementation-defined·. No error occurs if the implementation does not define any interpretation for the defined string. It is ·implementation-defined· what combinations of values of the format token, the language, and the cardinal/ordinal modifier are supported. If ordinal numbering is not supported for the combination of the format token, the language, and the string appearing in parentheses, the request is ignored and cardinal numbers are generated instead. The use of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);39 or let $para :=303 modifier disambiguates between numbering sequences that use letters. In many languages there are two commonly used numbering sequences that use letters. One numbering sequence assigns numeric values to letters in alphabetic sequence, and the other assigns numeric values to each letter in some other manner traditional in that language. In English, these would correspond to the numbering sequences specified by the format tokens declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);39 and let $para :=274. In some languages, the first member of each sequence is the same, and so the format token alone would be ambiguous. In the absence of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);39 or let $para :=303 modifier, the default is ·implementation-defined·.Error Conditions A dynamic error is raised [err:FODF1310] if the format token is invalid, that is, if it violates any mandatory rules (indicated by an emphasized must or required keyword in the above rules). For example, the error is raised if the primary format token contains a digit but does not match the required regular expression. Notes
The expression let $para :=333 returns let $para :=334. let $para :=335 might return let $para :=336 Ordinal numbering in Italian: The specification let $para :=337 with let $para :=242 equal to let $para :=339, if supported, should produce the sequence: 1º 2º 3º 4º ... The specification let $para :=340 with let $para :=242 equal to let $para :=339, if supported, should produce the sequence: Primo Secondo Terzo Quarto Quinto ... The expression let $para :=343 returns let $para :=344. let $para :=345 might return let $para :=346 The expression let $para :=347 returns let $para :=348. The expression let $para :=349 returns let $para :=350. The expression let $para :=351 returns let $para :=352. 4.7 Formatting numbersThis section defines a function for formatting decimal and floating point numbers. FunctionMeaninglet $para :=353Returns a string containing a number formatted according to a given picture string, taking account of decimal formats specified in the static context. Note: This function can be used to format any numeric quantity, including an integer. For integers, however, the let $para :=225 function offers additional possibilities. Note also that the picture strings used by the two functions are not 100% compatible, though they share some options in common. 4.7.1 Defining a decimal formatDecimal formats are defined in the static context, and the way they are defined is therefore outside the scope of this specification. XSLT and XQuery both provide custom syntax for creating a decimal format. The static context provides a set of decimal formats. One of the decimal formats is unnamed, the others (if any) are identified by a QName. There is always an unnamed decimal format available, but its contents are ·implementation-defined·. Each decimal format provides a set of named properties, described in the following table: NameTypeUsage (non-normative)let $para :=355A single ·character·Defines the character used to represent the decimal point (typically ".") both in the picture string and in the formatted number. let $para :=356A single ·character·Defines the character used to separate groups of digits (typically ",") both in the picture string and in the formatted number. let $para :=357A single ·character·Defines the character used to separate the mantissa from the exponent in scientific notation (typically "e") both in the picture string and in the formatted number. let $para :=358A ·string·Defines the string used to represent the value positive or negative infinity in the formatted number (typically "Infinity") let $para :=359A single ·character·Defines the character used as a minus sign in the formatted number if there is no subpicture for formatting negative numbers (typically "-", x2D) fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90A ·string·Defines the string used to represent the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 in the formatted number let $para :=362A single ·character·Defines the character used as a percent sign (typically "%") both in the picture string and in the formatted number let $para :=363A single ·character·Defines the character used as a per-mille sign (typically "‰", x2030) both in the picture string and in the formatted number let $para :=364A single ·character·, which must be a character in Unicode category Nd with decimal digit value 0 (zero)Defines the characters used in the picture string to represent a mandatory digit: for example, if the zero-digit is "0" then any of the digits "0" to "9" may be used (interchangeably) in the picture string to represent a mandatory digit, and in the formatted number the characters "0" to "9" will be used to represent the digits zero to nine. let $para :=365A single ·character·Defines the character used in the picture string to represent an optional digit (typically "#") let $para :=366A single ·character·Defines the character used in the picture string to separate the positive and negative subpictures (typically ";") Note: A phrase such as "The minus-signXP31 character" is to be read as "the character assigned to the minus-signXP31 property in the relevant decimal format within the static context". [Definition] The decimal digit family of a decimal format is the sequence of ten digits with consecutive Unicode ·codepoints· starting with the character that is the value of the zero-digitXP31 property. [Definition] The optional digit character is the character that is the value of the digitXP31 property. For any named or unnamed decimal format, the properties representing characters used in a ·picture string· must have distinct values. These properties are decimal-separatorXP31 , grouping-separatorXP31, exponent-separatorXP31, percentXP31, per-milleXP31, digitXP31, and pattern-separatorXP31. Furthermore, none of these properties may be equal to any ·character· in the ·decimal digit family·. 4.7.2 fn:format-numberSummaryReturns a string containing a number formatted according to a given picture string, taking account of decimal formats specified in the static context. Signatureslet $para :=353( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93, let $para :=230 let $para :=71 let $para :=10) let $para :=71 let $para :=10 let $para :=353( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'93, let $para :=230 let $para :=71 let $para :=10, let $para :=383 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on decimal formats, and namespaces. RulesThe effect of the two-argument form of the function is equivalent to calling the three-argument form with an empty sequence as the value of the third argument. The function formats fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 as a string using the ·picture string· specified by the let $para :=230 argument and the decimal-format named by the let $para :=383 argument, or the unnamed decimal-format, if there is no let $para :=383 argument. The syntax of the picture string is described in 4.7.3 Syntax of the picture string. The fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 argument may be of any numeric data type ( let $para :=26, let $para :=83, let $para :=82, or their subtypes including let $para :=85). Note that if an let $para :=82 is supplied, it is not automatically promoted to an let $para :=26, as such promotion can involve a loss of precision. If the supplied value of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 argument is an empty sequence, the function behaves as if the supplied value were the let $para :=26 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. The value of let $para :=383, if present and non-empty, must be a string which after removal of leading and trailing whitespace is in the form of an let $para :=403 as defined in the XPath 3.0 grammar, that is one of the following:
The decimal format that is used is the decimal format in the static context whose name matches let $para :=383 if supplied, or the unnamed decimal format in the static context otherwise. The evaluation of the let $para :=353 function takes place in two phases, an analysis phase described in 4.7.4 Analyzing the picture string and a formatting phase described in 4.7.5 Formatting the number. The analysis phase takes as its inputs the ·picture string· and the variables derived from the relevant decimal format in the static context, and produces as its output a number of variables with defined values. The formatting phase takes as its inputs the number to be formatted and the variables produced by the analysis phase, and produces as its output a string containing a formatted representation of the number. The result of the function is the formatted string representation of the supplied number. Error ConditionsA dynamic error is raised [err:FODF1280] if the name specified as the let $para :=383 argument is neither a valid lexical QName nor a valid let $para :=404, or if it uses a prefix that is not found in the statically known namespaces, or if the static context does not contain a declaration of a decimal-format with a matching expanded QName. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally signal this as a static error.Notes A string is an ordered sequence of characters, and this specification uses terms such as "left" and "right", "preceding" and "following" in relation to this ordering, irrespective of the position of the characters when visually rendered on some output medium. Both in the picture string and in the result string, digits with higher significance (that is, representing higher powers of ten) always precede digits with lower significance, even when the rendered text flow is from right to left. ExamplesThe following examples assume a default decimal format in which the chosen digits are the ASCII digits 0-9, the decimal separator is ".", the grouping separator is ",", the minus-sign is "-", and the percent-sign is "%". The expression let $para :=410 returns let $para :=411. The expression let $para :=412 returns let $para :=413. The expression let $para :=414 returns let $para :=415. The expression let $para :=416 returns let $para :=417. The expression let $para :=418 returns let $para :=419. The following example assumes the existence of a decimal format named 'ch' in which the grouping separator is let $para :=420 and the decimal separator is let $para :=421: The expression let $para :=422 returns let $para :=423. The following examples assume that the exponent separator is in decimal format 'fortran' is 'E': The expression let $para :=424 returns let $para :=425. The expression let $para :=426 returns let $para :=427. The expression let $para :=428 returns let $para :=429. The expression let $para :=430 returns let $para :=431. 4.7.3 Syntax of the picture stringNote: This differs from the let $para :=432 function previously defined in XSLT 2.0 in that any digit can be used in the picture string to represent a mandatory digit: for example the picture strings '000', '001', and '999' are equivalent. The digits will all be from the same decimal digit family, specifically, the sequence of ten consecutive digits starting with the digit assigned to the zero-digit property. This change is to align let $para :=432 (which previously used '000') with let $para :=434 (which used '001'). [Definition] The formatting of a number is controlled by a picture string. The picture string is a sequence of ·characters·, in which the characters assigned to the properties decimal-separatorXP31 , exponent-separatorXP31, grouping-separatorXP31, and digitXP31, and pattern-separatorXP31 and the members of the ·decimal digit family·, are classified as active characters, and all other characters (including the values of the properties percentXP31 and per-milleXP31) are classified as passive characters. A dynamic error is raised [err:FODF1310] if the ·picture string· does not conform to the following rules. Note that in these rules the words "preceded" and "followed" refer to characters anywhere in the string, they are not to be read as "immediately preceded" and "immediately followed".
The mantissa part of the sub-picture is defined as the part that appears to the left of the exponent-separator-sign if there is one, or the entire sub-picture otherwise. The exponent part of the subpicture is defined as the part that appears to the right of the exponent-separator-sign; if there is no exponent-separator-sign then the exponent part is absent. The integer part of the sub-picture is defined as the part that appears to the left of the decimal-separatorXP31 character if there is one, or the entire mantissa part otherwise. The fractional part of the sub-picture is defined as that part of the mantissa part that appears to the right of the decimal-separatorXP31 character if there is one, or the part that appears to the right of the rightmost active character otherwise. The fractional part may be zero-length. 4.7.4 Analyzing the picture stringThis phase of the algorithm analyzes the ·picture string· and the properties from the selected decimal format in the static context, and it has the effect of setting the values of various variables, which are used in the subsequent formatting phase. These variables are listed below. Each is shown with its initial setting and its datatype. Several variables are associated with each sub-picture. If there are two sub-pictures, then these rules are applied to one sub-picture to obtain the values that apply to positive and unsigned zero numbers, and to the other to obtain the values that apply to negative numbers. If there is only one sub-picture, then the values for both cases are derived from this sub-picture. The variables are as follows:
Note: If there is only one sub-picture, then all variables for positive numbers and negative numbers will be the same, except for prefix: the prefix for negative numbers will be preceded by the minus-signXP31 character. 4.7.5 Formatting the numberThis section describes the second phase of processing of the let $para :=353 function. This phase takes as input a number to be formatted (referred to as the input number), and the variables set up by analyzing the decimal format in the static context and the ·picture string·, as described above. The result of this phase is a string, which forms the return value of the let $para :=353 function. The algorithm for this second stage of processing is as follows:
4.8 Trigonometric and exponential functionsThe functions in this section perform trigonometric and other mathematical calculations on let $para :=26 values. They are provided primarily for use in applications performing geometrical computation, for example when generating SVG graphics. Functions are provided to support the six most commonly used trigonometric calculations: sine, cosine and tangent, and their inverses arc sine, arc cosine, and arc tangent. Other functions such as secant, cosecant, and cotangent are not provided because they are easily computed in terms of these six. The functions in this section (with the exception of let $para :=467) are specified by reference to [IEEE 754-2008], where they appear as Recommended operations in section 9. IEEE defines these functions for a variety of floating point formats; this specification defines them only for let $para :=26 values. The IEEE specification applies with the following caveats:
let $para :=467Returns an approximation to the mathematical constant π. let $para :=473Returns the value of ex. let $para :=474Returns the value of let $para :=054x. let $para :=476Returns the natural logarithm of the argument. let $para :=477Returns the base-ten logarithm of the argument. let $para :=478Returns the result of raising the first argument to the power of the second. let $para :=479Returns the non-negative square root of the argument. let $para :=87Returns the sine of the argument. The argument is an angle in radians. let $para :=88Returns the cosine of the argument. The argument is an angle in radians. let $para :=482Returns the tangent of the argument. The argument is an angle in radians. let $para :=483Returns the arc sine of the argument. let $para :=484Returns the arc cosine of the argument. let $para :=485Returns the arc tangent of the argument. let $para :=486Returns the angle in radians subtended at the origin by the point on a plane with coordinates (x, y) and the positive x-axis. 4.8.1 math:piSummaryReturns an approximation to the mathematical constant π. Signaturelet $para :=467() let $para :=71 let $para :=26Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThis function returns the let $para :=26 value whose lexical representation is 3.141592653589793e0Examples The expression let $para :=491 returns let $para :=492. The expression let $para :=493 converts an angle of 60 degrees to radians. 4.8.2 math:expSummaryReturns the value of ex. Signaturelet $para :=473( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the mathematical constant e raised to the power of let $para :=25, as defined in the [IEEE 754-2008] specification of the let $para :=502 function applied to 64-bit binary floating point values.Notes The treatment of overflow and underflow is defined in 4.2 Arithmetic operators on numeric values. ExamplesThe expression let $para :=503 returns let $para :=96. The expression let $para :=505 returns let $para :=506. The expression let $para :=507 returns let $para :=508 (approximately). The expression let $para :=509 returns let $para :=510. The expression let $para :=511 returns let $para :=512. The expression let $para :=513 returns let $para :=514. The expression let $para :=515 returns let $para :=220. The expression let $para :=517 returns let $para :=518. The expression let $para :=519 returns let $para :=169. 4.8.3 math:exp10SummaryReturns the value of let $para :=054x.Signature let $para :=474( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is ten raised to the power of let $para :=25, as defined in the [IEEE 754-2008] specification of the let $para :=530 function applied to 64-bit binary floating point values.Notes The treatment of overflow and underflow is defined in 4.2 Arithmetic operators on numeric values. ExamplesThe expression let $para :=531 returns let $para :=96. The expression let $para :=533 returns let $para :=506. The expression let $para :=535 returns let $para :=536. The expression let $para :=537 returns let $para :=538. The expression let $para :=539 returns let $para :=540. The expression let $para :=541 returns let $para :=220. The expression let $para :=543 returns let $para :=518. The expression let $para :=545 returns let $para :=169. 4.8.4 math:logSummaryReturns the natural logarithm of the argument. Signaturelet $para :=476( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the natural logarithm of let $para :=25, as defined in the [IEEE 754-2008] specification of the let $para :=555 function applied to 64-bit binary floating point values.Notes The treatment of 1º 2º 3º 4º ...89 and 1º 2º 3º 4º ...90 exceptions is defined in 4.2 Arithmetic operators on numeric values. The effect is that if the argument is zero, the result is 1º 2º 3º 4º ...57, and if it is negative, the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Examples The expression let $para :=560 returns let $para :=96. The expression let $para :=562 returns let $para :=563. The expression let $para :=564 returns let $para :=506. The expression let $para :=566 returns let $para :=567. The expression let $para :=568 returns let $para :=569. The expression let $para :=570 returns let $para :=220. The expression let $para :=572 returns let $para :=220. The expression let $para :=574 returns let $para :=518. The expression let $para :=576 returns let $para :=220. 4.8.5 math:log10SummaryReturns the base-ten logarithm of the argument. Signaturelet $para :=477( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the base-10 logarithm of let $para :=25, as defined in the [IEEE 754-2008] specification of the let $para :=586 function applied to 64-bit binary floating point values.Notes The treatment of 1º 2º 3º 4º ...89 and 1º 2º 3º 4º ...90 exceptions is defined in 4.2 Arithmetic operators on numeric values. The effect is that if the argument is zero, the result is 1º 2º 3º 4º ...57, and if it is negative, the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Examples The expression let $para :=591 returns let $para :=96. The expression let $para :=593 returns let $para :=563. The expression let $para :=595 returns let $para :=596. The expression let $para :=597 returns let $para :=598. The expression let $para :=599 returns let $para :=600. The expression let $para :=601 returns let $para :=220. The expression let $para :=603 returns let $para :=220. The expression let $para :=605 returns let $para :=518. The expression let $para :=607 returns let $para :=220. 4.8.6 math:powSummaryReturns the result of raising the first argument to the power of the second. Signaturelet $para :=478( let $para :=610 let $para :=71 let $para :=29, let $para :=613 let $para :=71 let $para :=72) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=610 is the empty sequence, the function returns the empty sequence. If let $para :=613 is an instance of let $para :=85, the result is let $para :=610 raised to the power of let $para :=613 as defined in the [IEEE 754-2008] specification of the let $para :=623 function applied to a 64-bit binary floating point value and an integer. Otherwise let $para :=613 is converted to an let $para :=26 by numeric promotion, and the result is the value of let $para :=610 raised to the power of let $para :=613 as defined in the [IEEE 754-2008] specification of the let $para :=628 function applied to two 64-bit binary floating point values.Notes The treatment of the 1º 2º 3º 4º ...89 and 1º 2º 3º 4º ...90 exceptions is defined in 4.2 Arithmetic operators on numeric values. Some of the consequences are illustrated in the examples below.Examples The expression let $para :=631 returns let $para :=96. The expression let $para :=633 returns let $para :=634. The expression let $para :=635 returns let $para :=636. The expression let $para :=637 returns let $para :=638. The expression let $para :=639 returns let $para :=640. The expression let $para :=641 returns let $para :=506. The expression let $para :=643 returns let $para :=506. The expression let $para :=645 returns let $para :=506. The expression let $para :=647 returns let $para :=506. The expression let $para :=649 returns let $para :=506. The expression let $para :=651 returns let $para :=169. The expression let $para :=653 returns let $para :=169. The expression let $para :=655 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=657 returns let $para :=169. The expression let $para :=659 returns let $para :=518. The expression let $para :=661 returns let $para :=518. The expression let $para :=663 returns let $para :=563. The expression let $para :=665 returns let $para :=518. The expression let $para :=667 returns let $para :=668. The expression let $para :=669 returns let $para :=670. The expression let $para :=671 returns let $para :=518. The expression let $para :=673 returns let $para :=563. (Odd-valued whole numbers are treated specially). The expression let $para :=675 returns let $para :=518. The expression let $para :=677 returns let $para :=518. The expression let $para :=679 returns let $para :=169. The expression let $para :=681 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. (Odd-valued whole numbers are treated specially). The expression let $para :=683 returns let $para :=169. The expression let $para :=685 returns let $para :=169. The expression let $para :=687 returns let $para :=506. The expression let $para :=689 returns let $para :=506. The expression let $para :=691 returns let $para :=506. The expression let $para :=693 returns let $para :=506. The expression let $para :=695 returns let $para :=506. The expression let $para :=697 returns let $para :=698. The expression let $para :=699 returns let $para :=220. 4.8.7 math:sqrtSummaryReturns the non-negative square root of the argument. Signaturelet $para :=479( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the mathematical non-negative square root of let $para :=25 as defined in the [IEEE 754-2008] specification of the let $para :=709 function applied to 64-bit binary floating point values.Notes The treatment of the 1º 2º 3º 4º ...90 exception is defined in 4.2 Arithmetic operators on numeric values. The effect is that if the argument is less than zero, the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. If let $para :=25 is positive or negative zero, positive infinity, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, then the result is let $para :=25. (Negative zero is the only case where the result can have negative sign)Examples The expression let $para :=715 returns let $para :=96. The expression let $para :=717 returns let $para :=169. The expression let $para :=719 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=721 returns let $para :=722. The expression let $para :=723 returns let $para :=724. The expression let $para :=725 returns let $para :=220. The expression let $para :=727 returns let $para :=220. The expression let $para :=729 returns let $para :=518. The expression let $para :=731 returns let $para :=220. 4.8.8 math:sinSummaryReturns the sine of the argument. The argument is an angle in radians. Signaturelet $para :=87( let $para :=734θ let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=734θ is the empty sequence, the function returns the empty sequence. Otherwise the result is the sine of let $para :=734θ (which is treated as an angle in radians) as defined in the [IEEE 754-2008] specification of the let $para :=741 function applied to 64-bit binary floating point values.Notes The treatment of the 1º 2º 3º 4º ...90 and let $para :=743 exceptions is defined in 4.2 Arithmetic operators on numeric values. If let $para :=734θ is positive or negative zero, the result is let $para :=734θ. If let $para :=734θ is positive or negative infinity, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. Otherwise the result is always in the range -1.0e0 to +1.0e0 ExamplesThe expression let $para :=749 returns let $para :=96. The expression let $para :=751 returns let $para :=169. The expression let $para :=753 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=755 returns let $para :=506 (approximately). The expression let $para :=757 returns let $para :=758 (approximately). The expression let $para :=759 returns let $para :=169 (approximately). The expression let $para :=761 returns let $para :=220. The expression let $para :=763 returns let $para :=220. The expression let $para :=765 returns let $para :=220. 4.8.9 math:cosSummaryReturns the cosine of the argument. The argument is an angle in radians. Signaturelet $para :=88( let $para :=734θ let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=734θ is the empty sequence, the function returns the empty sequence. If let $para :=734θ is positive or negative infinity, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. Otherwise the result is the cosine of let $para :=734θ (which is treated as an angle in radians) as defined in the [IEEE 754-2008] specification of the let $para :=778 function applied to 64-bit binary floating point values.Notes The treatment of the 1º 2º 3º 4º ...90 exception is defined in 4.2 Arithmetic operators on numeric values. If let $para :=734θ is positive or negative zero, the result is let $para :=734θ. If let $para :=734θ is positive or negative infinity, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. Otherwise the result is always in the range -1.0e0 to +1.0e0 ExamplesThe expression let $para :=785 returns let $para :=96. The expression let $para :=787 returns let $para :=506. The expression let $para :=789 returns let $para :=506. The expression let $para :=791 returns let $para :=169 (approximately). The expression let $para :=793 returns let $para :=169 (approximately). The expression let $para :=795 returns let $para :=758 (approximately). The expression let $para :=797 returns let $para :=220. The expression let $para :=799 returns let $para :=220. The expression let $para :=801 returns let $para :=220. 4.8.10 math:tanSummaryReturns the tangent of the argument. The argument is an angle in radians. Signaturelet $para :=482( let $para :=734θ let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=734θ is the empty sequence, the function returns the empty sequence. Otherwise the result is the tangent of let $para :=734θ (which is treated as an angle in radians) as defined in the [IEEE 754-2008] specification of the let $para :=811 function applied to 64-bit binary floating point values.Notes The treatment of the 1º 2º 3º 4º ...90 and let $para :=743 exceptions is defined in 4.2 Arithmetic operators on numeric values. If let $para :=734θ is positive or negative infinity, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Examples The expression let $para :=817 returns let $para :=96. The expression let $para :=819 returns let $para :=169. The expression let $para :=821 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=823 returns let $para :=506 (approximately). The expression let $para :=825 returns let $para :=758 (approximately). The expression let $para :=827 returns let $para :=169 (approximately). (Mathematically, tan(π/2) is positive infinity. But because let $para :=829 returns an approximation, the result of let $para :=830 will be a large but finite number.) The expression let $para :=831 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92 (approximately). (Mathematically, tan(-π/2) is negative infinity. But because let $para :=833 returns an approximation, the result of let $para :=834 will be a large but finite negative number.) The expression let $para :=835 returns let $para :=169 (approximately). The expression let $para :=837 returns let $para :=220. The expression let $para :=839 returns let $para :=220. The expression let $para :=841 returns let $para :=220. 4.8.11 math:asinSummaryReturns the arc sine of the argument. Signaturelet $para :=483( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the arc sine of let $para :=25 as defined in the [IEEE 754-2008] specification of the let $para :=851 function applied to 64-bit binary floating point values. The result is in the range -π/2 to +π/2 radians.Notes The treatment of the 1º 2º 3º 4º ...90 and let $para :=743 exceptions is defined in 4.2 Arithmetic operators on numeric values. If let $para :=25 is positive or negative zero, the result is let $para :=25. If let $para :=25 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, or if its absolute value is greater than one, then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. In other cases the result is an let $para :=26 value representing an angle θ in radians in the range -π let $para :=860θ let $para :=861π let $para :=862.Examples The expression let $para :=863 returns let $para :=96. The expression let $para :=865 returns let $para :=169. The expression let $para :=867 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=869 returns let $para :=870 (approximately). The expression let $para :=871 returns let $para :=872 (approximately). The expression let $para :=873 returns let $para :=220. The expression let $para :=875 returns let $para :=220. The expression let $para :=877 returns let $para :=220. The expression let $para :=879 returns let $para :=220. 4.8.12 math:acosSummaryReturns the arc cosine of the argument. Signaturelet $para :=484( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the arc cosine of let $para :=25, as defined in the [IEEE 754-2008] specification of the let $para :=889 function applied to 64-bit binary floating point values. The result is in the range zero to +π radians.Notes The treatment of the 1º 2º 3º 4º ...90 exception is defined in 4.2 Arithmetic operators on numeric values. If let $para :=25 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, or if its absolute value is greater than one, then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. In other cases the result is an let $para :=26 value representing an angle θ in radians in the range let $para :=895θ let $para :=861π.Examples The expression let $para :=897 returns let $para :=96. The expression let $para :=899 returns let $para :=870 (approximately). The expression let $para :=901 returns let $para :=870 (approximately). The expression let $para :=903 returns let $para :=169. The expression let $para :=905 returns let $para :=906 (approximately). The expression let $para :=907 returns let $para :=220. The expression let $para :=909 returns let $para :=220. The expression let $para :=911 returns let $para :=220. The expression let $para :=913 returns let $para :=220. 4.8.13 math:atanSummaryReturns the arc tangent of the argument. Signaturelet $para :=485( let $para :=25 let $para :=71 let $para :=29) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise the result is the arc tangent of let $para :=25, as defined in the [IEEE 754-2008] specification of the let $para :=923 function applied to 64-bit binary floating point values. The result is in the range -π/2 to +π/2 radians.Notes The treatment of the let $para :=743 exception is defined in 4.2 Arithmetic operators on numeric values. If let $para :=25 is positive or negative zero, the result is let $para :=25. If let $para :=25 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. In other cases the result is an let $para :=26 value representing an angle θ in radians in the range -π let $para :=860θ let $para :=861π let $para :=862.Examples The expression let $para :=934 returns let $para :=96. The expression let $para :=936 returns let $para :=169. The expression let $para :=938 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=940 returns let $para :=941 (approximately). The expression let $para :=942 returns let $para :=943 (approximately). The expression let $para :=944 returns let $para :=220. The expression let $para :=946 returns let $para :=870 (approximately). The expression let $para :=948 returns let $para :=872 (approximately). 4.8.14 math:atan2SummaryReturns the angle in radians subtended at the origin by the point on a plane with coordinates (x, y) and the positive x-axis. Signaturelet $para :=486( let $para :=613 let $para :=71 let $para :=26, let $para :=610 let $para :=71 let $para :=26) let $para :=71 let $para :=26Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe result is the value of let $para :=959 as defined in the [IEEE 754-2008] specification of the let $para :=960 function applied to 64-bit binary floating point values. The result is in the range -π to +π radians.Notes The treatment of the let $para :=743 exception is defined in 4.2 Arithmetic operators on numeric values. If either argument is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 then the result is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. If let $para :=613 is positive and let $para :=610 is positive and finite, then (subject to rules for overflow, underflow and approximation) the value of let $para :=966 is let $para :=967. If let $para :=613 is positive and let $para :=610 is negative and finite, then (subject to the same caveats) the value of let $para :=966 is π let $para :=971. Some results for special values of the arguments are shown in the examples below. ExamplesThe expression let $para :=972 returns let $para :=169. The expression let $para :=974 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=976 returns let $para :=906. The expression let $para :=978 returns let $para :=979. The expression let $para :=980 returns let $para :=872. The expression let $para :=982 returns let $para :=870. The expression let $para :=984 returns let $para :=979. The expression let $para :=986 returns let $para :=906. The expression let $para :=988 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).92. The expression let $para :=990 returns let $para :=991. 4.9 Random NumbersFunctionMeaninglet $para :=992Returns a random number generator, which can be used to generate sequences of random numbers. 4.9.1 fn:random-number-generatorSummaryReturns a random number generator, which can be used to generate sequences of random numbers. Signatureslet $para :=992() let $para :=71 let $para :=995 let $para :=992( let $para :=997 let $para :=71 let $para :=196) let $para :=71 let $para :=995Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe function returns a random number generator. A random number generator is represented as a map containing three entries. The keys of each entry are strings:
Calling the let $para :=992 function with no arguments is equivalent to calling the single-argument form of the function with an implementation-dependent seed. Calling the let $para :=992 function with an empty sequence as the value of let $para :=997 is equivalent to calling the single-argument form of the function with an implementation-dependent seed. If a let $para :=997 is supplied, it may be an atomic value of any type. Both forms of the function are ·deterministic·: calling the function twice with the same arguments, within a single ·execution scope·, produces the same results. The value of the let $para :=012 entry should be such that all eligible let $para :=26 values are equally likely to be chosen. The function returned in the let $para :=014 entry should be such that all permutations of the supplied sequence are equally likely to be chosen. The map returned by the let $para :=992 function may contain additional entries beyond those specified here, but it must match the type let $para :=995. The meaning of any additional entries is ·implementation-defined·. To avoid conflict with any future version of this specification, the keys of any such entries should start with an underscore character.Notes It is not meaningful to ask whether the functions returned in the let $para :=017 and let $para :=014 functions resulting from two separate calls with the same seed are "the same function", but the functions must be equivalent in the sense that calling them produces the same sequence of random numbers. The repeatability of the results of function calls in different execution scopes is outside the scope of this specification. It is recommended that when the same seed is provided explicitly, the same random number sequence should be delivered even in different execution scopes; while if no seed is provided, the processor should choose a seed that is likely to be different from one execution scope to another. (The same effect can be achieved explicitly by using let $para :=019 as a seed.) The specification does not place strong conformance requirements on the actual randomness of the result; this is left to the implementation. It is desirable, for example, when generating a sequence of random numbers that the sequence should not get into a repeating loop; but the specification does not attempt to dictate this. ExamplesThe following example returns a random permutation of the integers in the range 1 to 100: let $para :=020 The following example returns a 10% sample of the items in an input sequence let $para :=021, chosen at random: let $para :=022 The following code defines a function that can be called to produce a random sequence of let $para :=26 values in the range zero to one, of specified length: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200); 5 Functions on stringsThis section specifies functions and operators on the [XML Schema Part 2: Datatypes Second Edition] let $para :=10 datatype and the datatypes derived from it. 5.1 String typesThe operators described in this section are defined on the following types. Each type whose name is indented is derived from the type whose name appears nearest above with one less level of indentation. xs:string xs:normalizedString xs:token xs:language xs:NMTOKEN xs:Name xs:NCName xs:IDxs:IDREFxs:ENTITYThey also apply to user-defined types derived by restriction from the above types. 5.2 Functions to assemble and disassemble stringsFunctionMeaninglet $para :=025Returns an let $para :=10 whose characters have supplied ·codepoints·. let $para :=027Returns the sequence of ·codepoints· that constitute an let $para :=10 value. 5.2.1 fn:codepoints-to-stringSummaryReturns an let $para :=10 whose characters have supplied ·codepoints·.Signature let $para :=025( let $para :=25 let $para :=71 let $para :=033) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the string made up from the ·characters· whose Unicode ·codepoints· are supplied in let $para :=25. This will be the zero-length string if let $para :=25 is the empty sequence.Error Conditions A dynamic error is raised [err:FOCH0001] if any of the codepoints in let $para :=25 is not a permitted XML character.Examples The expression let $para :=039 returns let $para :=040. The expression let $para :=041 returns let $para :=042. The expression let $para :=043 returns let $para :=044. The expression let $para :=045 raises error let $para :=046. 5.2.2 fn:string-to-codepointsSummaryReturns the sequence of ·codepoints· that constitute an let $para :=10 value.Signature let $para :=027( let $para :=25 let $para :=71 let $para :=244) let $para :=71 let $para :=033Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns a sequence of integers, each integer being the Unicode ·codepoint· of the corresponding ·character· in let $para :=25. If let $para :=25 is a zero-length string or the empty sequence, the function returns the empty sequence.Examples The expression let $para :=056 returns let $para :=057. 5.3 Comparison of stringsFunctionMeaninglet $para :=058Returns -1, 0, or 1, depending on whether let $para :=059 collates before, equal to, or after let $para :=060 according to the rules of a selected collation. let $para :=061Returns true if two strings are equal, considered codepoint-by-codepoint. let $para :=062Given a string value and a collation, generates an internal value called a collation key, with the property that the matching and ordering of collation keys reflects the matching and ordering of strings under the specified collation. let $para :=063Determines whether or not any of the supplied strings, when tokenized at whitespace boundaries, contains the supplied token, under the rules of the supplied collation. 5.3.1 CollationsA collation is a specification of the manner in which ·strings· are compared and, by extension, ordered. When values whose type is let $para :=10 or a type derived from let $para :=10 are compared (or, equivalently, sorted), the comparisons are inherently performed according to some collation (even if that collation is defined entirely on codepoint values). The [Character Model for the World Wide Web 1.0: Fundamentals] observes that some applications may require different comparison and ordering behaviors than other applications. Similarly, some users having particular linguistic expectations may require different behaviors than other users. Consequently, the collation must be taken into account when comparing strings in any context. Several functions in this and the following section make use of a collation. Collations can indicate that two different codepoints are, in fact, equal for comparison purposes (e.g., "v" and "w" are considered equivalent in some Swedish collations). Strings can be compared codepoint-by-codepoint or in a linguistically appropriate manner, as defined by the collation. Some collations, especially those based on the Unicode Collation Algorithm (see [UTS #10]) can be "tailored" for various purposes. This document does not discuss such tailoring, nor does it provide a mechanism to perform tailoring. Instead, it assumes that the collation argument to the various functions below is a tailored and named collation. The ·Unicode codepoint collation· is a collation available in every implementation, which sorts based on codepoint values. For further details see 5.3.2 The Unicode Codepoint Collation. Collations may or may not perform Unicode normalization on strings before comparing them. This specification assumes that collations are named and that the collation name may be provided as an argument to string functions. Functions that allow specification of a collation do so with an argument whose type is let $para :=10 but whose lexical form must conform to an let $para :=30. If the collation is specified using a relative URI reference, it is resolved relative to the value of the static base URI property from the static context. This specification also defines the manner in which a default collation is determined if the collation argument is not specified in calls of functions that use a collation but allow it to be omitted. This specification does not define whether or not the collation URI is dereferenced. The collation URI may be an abstract identifier, or it may refer to an actual resource describing the collation. If it refers to a resource, this specification does not define the nature of that resource. One possible candidate is that the resource is a locale description expressed using the Locale Data Markup Language: see [UTS #35]. Functions such as let $para :=058 and let $para :=069 that compare let $para :=10 values use a single collation URI to identify all aspects of the collation rules. This means that any parameters such as the strength of the collation must be specified as part of the collation URI. For example, suppose there is a collation let $para :=071 that refers to a French collation that compares on the basis of base characters. Collations that use the same basic rules, but with higher strengths, for example, base characters and accents, or base characters, accents and case, would need to be given different names, say let $para :=072 and let $para :=073. Note that some specifications use the term collation to refer to an algorithm that can be parameterized, but in this specification, each possible parameterization is considered to be a distinct collation. The XQuery/XPath static context includes a provision for a default collation that can be used for string comparisons and ordering operations. See the description of the static context in Section 2.1.1 Static Context XP31. If the default collation is not specified by the user or the system, the default collation is the ·Unicode codepoint collation·. Note: XML allows elements to specify the let $para :=297 attribute to indicate the language associated with the content of such an element. This specification does not use let $para :=297 to identify the default collation because using let $para :=297 does not produce desired effects when the two strings to be compared have different let $para :=297 values or when a string is multilingual. 5.3.2 The Unicode Codepoint Collation[Definition] The collation URI The Unicode codepoint collation does not perform any normalization on the supplied strings. The collation is defined as follows. Each of the two strings is converted to a sequence of integers using the let $para :=027 function. These two sequences let $para :=080 and let $para :=081 are then compared as follows:
Note: While the Unicode codepoint collation does not produce results suitable for quality publishing of printed indexes or directories, it is adequate for many purposes where a restricted alphabet is used, such as sorting of vehicle registrations. 5.3.3 The Unicode Collation AlgorithmThis specification defines a family of collation URIs representing tailorings of the Unicode Collation Algorithm (UCA) as defined in [UTS #10]. The parameters used for tailoring the UCA are based on the parameters defined in the Locale Data Markup Language (LDML), defined in [UTS #35]. This family of URIs use the scheme and path let $para :=092 followed by an optional query part. The query part, if present, consists of a question mark followed by a sequence of zero or more semicolon-separated parameters. Each parameter is a keyword-value pair, the keyword and value being separated by an equals sign. All implementations must recognize URIs in this family in the let $para :=093 argument of functions that take a collation argument. If the let $para :=094 parameter is present with the value let $para :=095, then the implementation must either use a collation that conforms with the rules in the Unicode specifications for the requested tailoring, or fail with a static or dynamic error indicating that it does not provide the collation (the error code should be the same as if the collation URI were not recognized). If the let $para :=094 parameter is omitted or takes the value let $para :=097, and if the collation URI is well-formed according to the rules in this section, then the implementation must accept the collation URI, and should use the available collation that most closely reflects the user's intentions. For example, if the collation URI requested is let $para :=098 and the implementation does not include a fully conformant version of the UCA tailored for Swedish, then it may choose to use a Swedish collation that is known to differ from the UCA definition, or one whose conformance has not been established. It might even, as a last resort, fall back to using codepoint collation. If two query parameters use the same keyword then the last one wins. If a query parameter uses a keyword or value which is not defined in this specification then the meaning is ·implementation-defined·. If the implementation recognizes the meaning of the keyword and value then it should interpret it accordingly; if it does not recognize the keyword or value then if the let $para :=094 parameter is present with the value let $para :=095 it should reject the collation as unsupported, otherwise it should ignore the unrecognized parameter. The following query parameters are defined. If any parameter is absent, the default is ·implementation-defined· except where otherwise stated. The meaning given for each parameter is non-normative; the normative specification is found in [UTS #35]. KeywordValuesMeaningfallbackyes | no (default yes)Determines whether the processor uses a fallback collation if a conformant collation is not available.langlanguage code: a string in the lexical space oflet $para :=101.The language whose collation conventions are to be used.versionstringThe version number of the UCA to be used.strength (default tertiary)primary | secondary | tertiary | quaternary | identical, or 1|2|3|4|5 as synonymsThe collation strength as defined in UCA. Primary strength takes only the base form of the character into account (so A=a=Ä=ä); secondary strength ignores case but considers accents and diacritics as significant (so A=a and Ä=ä but ä≠a); tertiary considers case as significant (A≠a≠Ä≠ä); quaternary considers spaces and punctuation that would otherwise be ignored (for example let $para :=102= let $para :=103).maxVariablespace | punct | symbol | currency (default punct)Indicates that all characters in the specified group and earlier groups are treated as "noise" characters to be handled as defined by the let $para :=104 parameter. For example, let $para :=105 indicates that characters classified as whitespace or punctuation get this treatment.alternatenon-ignorable | shifted | blanked (default non-ignorable)Controls the handling of characters such as spaces and hyphens; specifically, the "noise" characters in the groups selected by the let $para :=106 parameter. The value let $para :=107 indicates that such characters are treated as distinct at the primary level (so let $para :=108 sorts before let $para :=109); let $para :=110 indicates that they are used to differentiate two strings only at the let $para :=111 level, and let $para :=112 indicates that they are taken into account only at the let $para :=113 level.backwardsyes | no (default no)The value let $para :=114 indicates that the last accent in the string is the most significant.normalizationyes | no (default no)Indicates whether strings are converted to normalization form D.caseLevelyes | no (default no)When used with primary strength, setting let $para :=115 has the effect of ignoring accents while taking account of case.caseFirstupper | lowerIndicates whether upper-case precedes lower-case or vice versa.numericyes | no (default no)When let $para :=116 is specified, a sequence of consecutive digits is interpreted as a number, for example let $para :=117 sorts before let $para :=118.reordera comma-separated sequence of reorder codes, where a reorder code is one of let $para :=119, let $para :=120, let $para :=121, let $para :=122, let $para :=365, or a four-letter script code defined in [ISO 15924 Register], the register of scripts maintained by the Unicode Consortium in its capacity as registration authority for [ISO 15924].Determines the relative ordering of text in different scripts; for example the value let $para :=124 indicates that digits precede Greek letters, which precede Latin letters. Note: This list excludes parameters that are inconvenient to express in a URI, or that are applicable only to substring matching. 5.3.4 The HTML ASCII Case-Insensitive CollationThe collation URI let $para :=125 must be recognized by every implementation. It is used to refer to the HTML ASCII case-insensitive collation as defined in [HTML5: A vocabulary and associated APIs for HTML and XHTML] (section 2.5, Case sensitivity and string comparison). It is used, for example, when matching HTML let $para :=126 attribute values. Note: The definition of the collation is paraphrased here for convenience: Comparing two strings in an ASCII case-insensitive manner means comparing them exactly, codepoint for codepoint, except that the characters in the range x41 to x5A (A-Z) and the corresponding characters in the range x61 to x7A (a-z) are considered to also match. HTML5 defines the semantics of equality matching using this collation; it does not define rules for ordering. If the collation is used for ordering, the results are ·implementation-defined·. The collation supports collation units and can therefore be used with functions such as let $para :=127; each Unicode codepoint is a single collation unit. 5.3.5 Choosing a collationMany functions have two signatures, where one signature includes a let $para :=128 argument and the other omits this argument. The collation to use for these functions is determined by the following rules:
Note: Because the set of collations that are supported is ·implementation-defined·, an implementation has the option to support all collation URIs, in which case it will never raise this error. If the value of the collation argument is a relative URI reference, it is resolved against the base-URI from the static context. If it is a relative URI reference and cannot be resolved, perhaps because the base-URI property in the static context is absent, a dynamic error is raised [err:FOCH0002]. Note: There is no explicit requirement that the string used as a collation URI be a valid URI. Implementations will in many cases reject such strings on the grounds that do not identify a supported collation; they may also cause an error if they cannot be resolved against the static base URI. 5.3.6 fn:compareSummaryReturns -1, 0, or 1, depending on whether let $para :=059 collates before, equal to, or after let $para :=060 according to the rules of a selected collation.Signatures let $para :=058( let $para :=059 let $para :=71 let $para :=244, let $para :=060 let $para :=71 let $para :=244) let $para :=71 let $para :=229 let $para :=058( let $para :=059 let $para :=71 let $para :=244, let $para :=060 let $para :=71 let $para :=244, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=229Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesReturns -1, 0, or 1, depending on whether the value of the let $para :=059 is respectively less than, equal to, or greater than the value of let $para :=060, according to the rules of the collation that is used. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. If either let $para :=059 or let $para :=060 is the empty sequence, the function returns the empty sequence. This function, called with the first signature, defines the semantics of the "eq", "ne", "gt", "lt", "le" and "ge" operators on let $para :=10 values.Examples The expression let $para :=158 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression let $para :=160 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. (Assuming the default collation includes provisions that equate "ss" and the (German) character "ß" ("sharp-s"). Otherwise, the returned value depends on the semantics of the default collation.) The expression let $para :=162 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. (The specified collation equates "ss" and the (German) character "ß" ("sharp-s").) The expression let $para :=164 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. (Assuming the default collation includes provisions that treat differences between "ss" and the (German) character "ß" ("sharp-s") with less strength than the differences between the base characters, such as the final "n". ). 5.3.7 fn:codepoint-equalSummaryReturns true if two strings are equal, considered codepoint-by-codepoint. Signaturelet $para :=061( let $para :=059 let $para :=71 let $para :=244, let $para :=060 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf either argument is the empty sequence, the function returns the empty sequence. Otherwise, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 depending on whether the value of let $para :=059 is equal to the value of let $para :=060, according to the Unicode codepoint collation ( let $para :=078).Notes This function allows let $para :=30 values to be compared without having to specify the Unicode codepoint collation.Examples The expression let $para :=181 returns let $para :=182. The expression let $para :=183 returns let $para :=184. The expression let $para :=185 returns let $para :=182. The expression let $para :=187 returns let $para :=96. The expression let $para :=189 returns let $para :=96. 5.3.8 fn:collation-keySummaryGiven a string value and a collation, generates an internal value called a collation key, with the property that the matching and ordering of collation keys reflects the matching and ordering of strings under the specified collation. Signatureslet $para :=062( let $para :=192 let $para :=71 let $para :=10) let $para :=71 let $para :=196 let $para :=062( let $para :=192 let $para :=71 let $para :=10, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=196Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. RulesCalling the one-argument version of this function is equivalent to calling the two-argument version supplying the default collation as the second argument. The function returns an ·implementation-dependent· value with the property that, for any two strings let $para :=206 and let $para :=207:
The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. Collation keys are defined as let $para :=196 values to ensure unambiguous and context-free comparison semantics. An implementation is free to generate a collation key in any convenient way provided that it always generates the same collation key for two strings that are equal under the collation, and different collation keys for strings that are not equal. This holds only within a single ·execution scope·; an implementation is under no obligation to generate the same collation keys during a subsequent unrelated query or transformation. It is possible to define collations that do not have the ability to generate collation keys. Supplying such a collation will cause the function to fail. The ability to generate collation keys is an ·implementation-defined· property of the collation. Error ConditionsAn error is raised [err:FOCH0004] if the specified collation does not support the generation of collation keys. NotesThe function is provided primarily for use with maps. If a map is required where codepoint equality is inappropriate for comparing keys, then a common technique is to normalize the key so that equality matching becomes feasible. There are many ways keys can be normalized, for example by use of functions such as let $para :=213, let $para :=214, let $para :=215, or let $para :=216, but this function provides a way of normalizing them according to the rules of a specified collation. For example, if the collation ignores accents, then the function will generate the same collation key for two input strings that differ only in their use of accents. The result of the function is defined to be an let $para :=196 value. Binary values are chosen because they have unambiguous and context-free comparison semantics, because the value space is unbounded, and because the ordering rules are such that between any two values in the ordered value space, an arbitrary number of further values can be interpolated. The choice between let $para :=196 and let $para :=219 is arbitrary; the only operation that behaves differently between the two binary data types is conversion to/from a string, and this operation is not one that is normally required for effective use of collation keys. For collations based on the Unicode Collation Algorithm, an algorithm for computing collation keys is provided in [UTS #10]. Implementations are not required to use this algorithm. This specification does not mandate that collation keys should retain ordering. This is partly because the primary use case is for maps, where only equality comparisons are required, and partly to allow the use of binary data types (which are currently unordered types) for the result. The specification may be revised in a future release to specify that ordering is preserved. The fact that collation keys are ordered can be exploited in XQuery, whose let $para :=220 clause does not allow the collation to be selected dynamically. This restriction can be circumvented by rewriting the clause let $para :=221 as let $para :=222, where let $para :=128 allows the collation to be chosen dynamically. Note that let $para :=196 becomes an ordered type in XPath 3.1, making binary collation keys possible.Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary' The expression let $para :=225 returns let $para :=226. (Given that the keys of the two entries are equal under the rules of the chosen collation, only one of the entries can appear in the result; the one that is chosen is the one from the last map in the input sequence.) The expression let $para :=227 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. (The strings "A" and "a" have the same collation key under this collation.) As the above examples illustrate, it is important that when the let $para :=229 function is used to add entries to a map, then it must also be used when retrieving entries from the map. This process can be made less error-prone by encapsulating the map within a function: let $para :=230. 5.3.9 fn:contains-tokenSummaryDetermines whether or not any of the supplied strings, when tokenized at whitespace boundaries, contains the supplied token, under the rules of the supplied collation. Signatureslet $para :=063( let $para :=232 let $para :=71 let $para :=234, let $para :=235 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 let $para :=063( let $para :=232 let $para :=71 let $para :=234, let $para :=235 let $para :=71 let $para :=10, let $para :=128 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesIf let $para :=232 is the empty sequence, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. Leading and trailing whitespace is trimmed from the supplied value of let $para :=235. If the trimmed value of let $para :=235 is a zero-length string, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns true if and only if there is string in let $para :=232 which, after tokenizing at whitespace boundaries, contains a token that is equal to the trimmed value of let $para :=235 under the rules of the selected collation. That is, the function returns the value of the expression: let $para :=0Notes Interior whitespace within let $para :=235 will cause the function to return let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, unless such whitespace is ignored by the selected collation. This function can be used for processing space-separated attribute values (for example, the XHTML and DITA class attribute), where one often needs to test for the presence of a single token in a space-separated list. The function is designed to work both when the attribute has been validated against an XSD list type, and when it appears as a single untyped string. It differs from the HTML 5 definition in that HTML 5 recognizes form feed (x0C) as a separator. To reproduce the HTML token matching behavior, the HTML ASCII case-insensitive collation should be used: see 5.3.4 The HTML ASCII Case-Insensitive Collation. ExamplesThe expression let $para :=261 returns let $para :=182. The expression let $para :=263 returns let $para :=182. The expression let $para :=265 returns let $para :=184. The expression let $para :=267 returns let $para :=182. 5.4 Functions on string valuesThe following functions are defined on values of type let $para :=10 and types derived from it.FunctionMeaning let $para :=98Returns the concatenation of the string values of the arguments. let $para :=271Returns a string created by concatenating the items in a sequence, with a defined separator between adjacent items. let $para :=61Returns the portion of the value of let $para :=273 beginning at the position indicated by the value of let $para :=274 and continuing for the number of ·characters· indicated by the value of let $para :=275. let $para :=62Returns the number of ·characters· in a string. let $para :=215Returns the value of let $para :=25 with leading and trailing whitespace removed, and sequences of internal whitespace reduced to a single space character. let $para :=216Returns the value of let $para :=25 after applying Unicode normalization. let $para :=213Converts a string to upper case. let $para :=214Converts a string to lower case. let $para :=63Returns the value of let $para :=25 modified by replacing or removing individual characters. Notes: When the above operators and functions are applied to datatypes derived from let $para :=10, they are guaranteed to return values that are instances of let $para :=10, but the value might or might not be an instance of the particular subtype of let $para :=10 to which they were applied. The strings returned by let $para :=98 and let $para :=271 are not guaranteed to be normalized. But see note in let $para :=98. 5.4.1 fn:concatSummaryReturns the concatenation of the string values of the arguments. Operator MappingThe two-argument form of this function defines the semantics of the "||" operator. Signaturelet $para :=98( let $para :=70 let $para :=71 let $para :=196, let $para :=73 let $para :=71 let $para :=196,...) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThis function accepts two or more let $para :=34 arguments and casts each one to let $para :=10. The function returns the let $para :=10 that is the concatenation of the values of its arguments after conversion. If any argument is the empty sequence, that argument is treated as the zero-length string. The let $para :=98 function is specified to allow two or more arguments, which are concatenated together. This is the only function specified in this document that allows a variable number of arguments. This capability is retained for compatibility with [XML Path Language (XPath) Version 1.0].Notes As mentioned in 5.1 String types Unicode normalization is not automatically applied to the result of let $para :=98. If a normalized result is required, let $para :=216 can be applied to the let $para :=10 returned by let $para :=98. The following XQuery: let $para :=1 where the "?" represents either the actual Unicode character COMBINING DIARESIS (Unicode codepoint U+0308) or "̈", will return: "I plan to go to Mu?nchen in September" where the "?" represents either the actual Unicode character COMBINING DIARESIS (Unicode codepoint U+0308) or "̈". It is worth noting that the returned value is not normalized in NFC; however, it is normalized in NFD. However, the following XQuery: let $para :=2 where the "?" represents either the actual Unicode character COMBINING DIARESIS (Unicode codepoint U+0308) or "̈", will return: "I plan to go to München in September" This returned result is normalized in NFC. ExamplesThe expression let $para :=308 returns let $para :=309. The expression let $para :=310 returns let $para :=311. The expression let $para :=312 returns let $para :=313. The expression let $para :=314 returns let $para :=315. The expression let $para :=316 returns let $para :=317. The expression let $para :=318 returns let $para :=319. 5.4.2 fn:string-joinSummaryReturns a string created by concatenating the items in a sequence, with a defined separator between adjacent items. Signatureslet $para :=271( let $para :=70 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 let $para :=10 let $para :=271( let $para :=70 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, let $para :=73 let $para :=71 let $para :=10) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of calling the single-argument version of this function is the same as calling the two-argument version with let $para :=73 set to a zero-length string. The function returns an let $para :=10 created by casting each item in the sequence let $para :=70 to an let $para :=10, and then concatenating the result strings in order, using the value of let $para :=73 as a separator between adjacent strings. If the value of let $para :=73 is the zero-length string, then the members of let $para :=70 are concatenated without a separator.Notes If the value of let $para :=70 is the empty sequence, the function returns the zero-length string.Examples The expression let $para :=343 returns let $para :=344. The expression let $para :=345 returns let $para :=346. The expression let $para :=347 returns let $para :=348. The expression let $para :=349 returns let $para :=044. The expression let $para :=351 returns let $para :=352. let $para :=3 The expression let $para :=353 returns let $para :=354. The expression let $para :=355 returns let $para :=356. 5.4.3 fn:substringSummaryReturns the portion of the value of let $para :=273 beginning at the position indicated by the value of let $para :=274 and continuing for the number of ·characters· indicated by the value of let $para :=275.Signatures let $para :=61( let $para :=273 let $para :=71 let $para :=244, let $para :=274 let $para :=71 let $para :=26) let $para :=71 let $para :=10 let $para :=61( let $para :=273 let $para :=71 let $para :=244, let $para :=274 let $para :=71 let $para :=26, let $para :=275 let $para :=71 let $para :=26) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=273 is the empty sequence, the function returns the zero-length string. Otherwise, the function returns a string comprising those ·characters· of let $para :=273 whose index position (counting from one) is greater than or equal to the value of let $para :=274 (rounded to an integer), and (if let $para :=275 is specified) less than the sum of let $para :=274 and let $para :=275 (both rounded to integers). The characters returned do not extend beyond let $para :=273. If let $para :=274 is zero or negative, only those characters in positions greater than zero are returned. More specifically, the three argument version of the function returns the characters in let $para :=273 whose position let $para :=390 satisfies: let $para :=391 The two argument version of the function assumes that let $para :=275 is infinite and thus returns the ·characters· in let $para :=273 whose position let $para :=390 satisfies: let $para :=395 In the above computations, the rules for let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'11 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'15 apply.Notes The first character of a string is located at position 1, not position 0. The second and third arguments allow let $para :=26 values (rather than requiring let $para :=85) in order to achieve compatibility with XPath 1.0. A surrogate pair counts as one character, not two. The consequences of supplying values such as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 or positive or negative infinity for the let $para :=274 or let $para :=275 arguments follow from the above rules, and are not always intuitive.Examples The expression let $para :=403 returns let $para :=404. (Characters starting at position 6 to the end of let $para :=273 are selected.) The expression let $para :=406 returns let $para :=407. (Characters at positions greater than or equal to 4 and less than 7 are selected.) The expression let $para :=408 returns let $para :=409. (Characters at positions greater than or equal to 2 and less than 5 are selected.) The expression let $para :=410 returns let $para :=411. (Characters at positions greater than or equal to 0 and less than 3 are selected. Since the first position is 1, these are the characters at positions 1 and 2.) The expression let $para :=412 returns let $para :=044. (Characters at positions greater than or equal to 5 and less than 2 are selected.) The expression let $para :=414 returns let $para :=415. (Characters at positions greater than or equal to -3 and less than 2 are selected. Since the first position is 1, this is the character at position 1.) The expression let $para :=416 returns let $para :=044. (Since let $para :=418 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 compared to any other number returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, no characters are selected.) The expression let $para :=422 returns let $para :=044. (As above.) The expression let $para :=424 returns let $para :=044. The expression let $para :=426 returns let $para :=427. (Characters at positions greater than or equal to -42 and less than 1º 2º 3º 4º ...56 are selected.) The expression let $para :=429 returns let $para :=044. (Since the value of let $para :=431 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, no characters are selected.) 5.4.4 fn:string-lengthSummaryReturns the number of ·characters· in a string. Signatureslet $para :=62() let $para :=71 let $para :=85 let $para :=62( let $para :=25 let $para :=71 let $para :=244) let $para :=71 let $para :=85Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns an let $para :=85 equal to the length in ·characters· of the value of let $para :=25. Calling the zero-argument version of the function is equivalent to calling let $para :=444. If the value of let $para :=25 is the empty sequence, the function returns the let $para :=85 value zero (0).Error Conditions If let $para :=25 is not specified and the context item is absentDM31, a dynamic error is raised: [err:XPDY0002]XP31.Notes Unlike some programming languages, a ·codepoint· greater than 65535 counts as one character, not two. There are situations where let $para :=448 has a different effect from let $para :=449. For example, if the context item is an attribute node typed as an let $para :=85 with the string value let $para :=451, then let $para :=448 returns 6 (the length of the string value of the node), while let $para :=449 raises a type error (because the result of atomization is not an let $para :=10).Examples The expression let $para :=455 returns let $para :=456. The expression let $para :=457 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 5.4.5 fn:normalize-spaceSummaryReturns the value of let $para :=25 with leading and trailing whitespace removed, and sequences of internal whitespace reduced to a single space character.Signatures let $para :=215() let $para :=71 let $para :=10 let $para :=215( let $para :=25 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is the empty sequence, the function returns the zero-length string. The function returns a string constructed by stripping leading and trailing whitespace from the value of let $para :=25, and replacing sequences of one or more adjacent whitespace characters with a single space, let $para :=471. The whitespace characters are defined in the metasymbol S (Production 3) of [Extensible Markup Language (XML) 1.0 (Fifth Edition)]. If no argument is supplied, then let $para :=25 defaults to the string value (calculated using let $para :=78) of the context item ( let $para :=19).Error Conditions If no argument is supplied and the context item is absentDM31 then a dynamic error is raised: [err:XPDY0002]XP31. NotesThe definition of whitespace is unchanged in [Extensible Markup Language (XML) 1.1 Recommendation]. It is repeated here for convenience: let $para :=475Examples The expression let $para :=476 returns let $para :=477. The expression let $para :=478 returns let $para :=044. 5.4.6 fn:normalize-unicodeSummaryReturns the value of let $para :=25 after applying Unicode normalization.Signatures let $para :=216( let $para :=25 let $para :=71 let $para :=244) let $para :=71 let $para :=10 let $para :=216( let $para :=25 let $para :=71 let $para :=244, let $para :=491 let $para :=71 let $para :=10) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is the empty sequence, the function returns the zero-length string. If the single-argument version of the function is used, the result is the same as calling the two-argument version with let $para :=491 set to the string "NFC". Otherwise, the function returns the value of let $para :=25 normalized according to the rules of the normalization form identified by the value of let $para :=491. The effective value of let $para :=491 is the value of the expression let $para :=501.
Normalization forms NFC, NFD, NFKC, and NFKD, and the algorithms to be used for converting a string to each of these forms, are defined in [UAX #15]. The motivation for normalization form FULLY-NORMALIZED is explained in [Character Model for the World Wide Web 1.0: Normalization]. However, as that specification did not progress beyond working draft status, the normative specification is as follows:
Conforming implementations must support normalization form "NFC" and may support normalization forms "NFD", "NFKC", "NFKD", and "FULLY-NORMALIZED". They may also support other normalization forms with ·implementation-defined· semantics. It is ·implementation-defined· which version of Unicode (and therefore, of the normalization algorithms and their underlying data) is supported by the implementation. See [UAX #15] for details of the stability policy regarding changes to the normalization rules in future versions of Unicode. If the input string contains codepoints that are unassigned in the relevant version of Unicode, or for which no normalization rules are defined, the let $para :=216 function leaves such codepoints unchanged. If the implementation supports the requested normalization form then it must be able to handle every input string without raising an error.Error Conditions A dynamic error is raised [err:FOCH0003] if the effective value of the let $para :=491 argument is not one of the values supported by the implementation. 5.4.7 fn:upper-caseSummaryConverts a string to upper case. Signaturelet $para :=213( let $para :=25 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is the empty sequence, the zero-length string is returned. Otherwise, the function returns the value of let $para :=25 after translating every ·character· to its upper-case correspondent as defined in the appropriate case mappings section in the Unicode standard [The Unicode Standard]. For versions of Unicode beginning with the 2.1.8 update, only locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and likely future versions) of Unicode, precise mappings are described in default case operations, which are full case mappings in the absence of tailoring for particular languages and environments. Every lower-case character that does not have an upper-case correspondent, as well as every upper-case character, is included in the returned value in its original form.Notes Case mappings may change the length of a string. In general, the let $para :=213 and let $para :=214 functions are not inverses of each other: let $para :=526 is not guaranteed to return let $para :=25, nor is let $para :=528. The Latin small letter dotless i (as used in Turkish) is perhaps the most prominent lower-case letter which will not round-trip. The Latin capital letter i with dot above is the most prominent upper-case letter which will not round trip; there are others, such as Latin capital letter Sharp S (#1E9E) which was introduced in Unicode 5.1. These functions may not always be linguistically appropriate (e.g. Turkish i without dot) or appropriate for the application (e.g. titlecase). In cases such as Turkish, a simple translation should be used first. Because the function is not sensitive to locale, results will not always match user expectations. In Quebec, for example, the standard uppercase equivalent of "è" is "È", while in metropolitan France it is more commonly "E"; only one of these is supported by the functions as defined. Many characters of class Ll lack uppercase equivalents in the Unicode case mapping tables; many characters of class Lu lack lowercase equivalents. ExamplesThe expression let $para :=529 returns let $para :=530. 5.4.8 fn:lower-caseSummaryConverts a string to lower case. Signaturelet $para :=214( let $para :=25 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is the empty sequence, the zero-length string is returned. Otherwise, the function returns the value of let $para :=25 after translating every ·character· to its lower-case correspondent as defined in the appropriate case mappings section in the Unicode standard [The Unicode Standard]. For versions of Unicode beginning with the 2.1.8 update, only locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and likely future versions) of Unicode, precise mappings are described in default case operations, which are full case mappings in the absence of tailoring for particular languages and environments. Every upper-case character that does not have a lower-case correspondent, as well as every lower-case character, is included in the returned value in its original form.Notes Case mappings may change the length of a string. In general, the let $para :=213 and let $para :=214 functions are not inverses of each other: let $para :=526 is not guaranteed to return let $para :=25, nor is let $para :=528. The Latin small letter dotless i (as used in Turkish) is perhaps the most prominent lower-case letter which will not round-trip. The Latin capital letter i with dot above is the most prominent upper-case letter which will not round trip; there are others, such as Latin capital letter Sharp S (#1E9E) which was introduced in Unicode 5.1. These functions may not always be linguistically appropriate (e.g. Turkish i without dot) or appropriate for the application (e.g. titlecase). In cases such as Turkish, a simple translation should be used first. Because the function is not sensitive to locale, results will not always match user expectations. In Quebec, for example, the standard uppercase equivalent of "è" is "È", while in metropolitan France it is more commonly "E"; only one of these is supported by the functions as defined. Many characters of class Ll lack uppercase equivalents in the Unicode case mapping tables; many characters of class Lu lack lowercase equivalents. ExamplesThe expression let $para :=544 returns let $para :=545. 5.4.9 fn:translateSummaryReturns the value of let $para :=25 modified by replacing or removing individual characters.Signature let $para :=63( let $para :=25 let $para :=71 let $para :=244, let $para :=551 let $para :=71 let $para :=10, let $para :=554 let $para :=71 let $para :=10) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is the empty sequence, the function returns the zero-length string. Otherwise, the function returns a result string constructed by processing each ·character· in the value of let $para :=25, in order, according to the following rules:
If let $para :=551 is the zero-length string then the function returns let $para :=25 unchanged. If a character occurs more than once in let $para :=551, then the first occurrence determines the action taken. If let $para :=554 is longer than let $para :=551, the excess characters are ignored.Examples The expression let $para :=572 returns let $para :=573. The expression let $para :=574 returns let $para :=575. The expression let $para :=576 returns let $para :=577. 5.5 Functions based on substring matchingThe functions described in the section examine a string let $para :=70 to see whether it contains another string let $para :=73 as a substring. The result depends on whether let $para :=73 is a substring of let $para :=70, and if so, on the range of ·characters· in let $para :=70 which let $para :=73 matches. When the ·Unicode codepoint collation· is used, this simply involves determining whether let $para :=70 contains a contiguous sequence of characters whose ·codepoints· are the same, one for one, with the codepoints of the characters in let $para :=73. When a collation is specified, the rules are more complex. All collations support the capability of deciding whether two ·strings· are considered equal, and if not, which of the strings should be regarded as preceding the other. For functions such as let $para :=058, this is all that is required. For other functions, such as let $para :=127, the collation needs to support an additional property: it must be able to decompose the string into a sequence of collation units, each unit consisting of one or more characters, such that two strings can be compared by pairwise comparison of these units. ("collation unit" is equivalent to "collation element" as defined in [UTS #10].) The string let $para :=70 is then considered to contain let $para :=73 as a substring if the sequence of collation units corresponding to let $para :=73 is a subsequence of the sequence of the collation units corresponding to let $para :=70. The characters in let $para :=70 that match are the characters corresponding to these collation units. This rule may occasionally lead to surprises. For example, consider a collation that treats "Jaeger" and "Jäger" as equal. It might do this by treating "ä" as representing two collation units, in which case the expression let $para :=593 will return op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. Alternatively, a collation might treat "ae" as a single collation unit, in which case the expression let $para :=595 will return let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The results of these functions thus depend strongly on the properties of the collation that is used. In addition, collations may specify that some collation units should be ignored during matching. If hyphen is an ignored collation unit, then let $para :=597 will be true, and let $para :=598 will also be true. In the definitions below, we refer to the terms match and minimal match as defined in definitions DS2 and DS4 of [UTS #10]. In applying these definitions:
It is possible to define collations that do not have the ability to decompose a string into units suitable for substring matching. An argument to a function defined in this section may be a URI that identifies a collation that is able to compare two strings, but that does not have the capability to split the string into collation units. Such a collation may cause the function to fail, or to give unexpected results or it may be rejected as an unsuitable argument. The ability to decompose strings into collation units is an ·implementation-defined· property of the collation. FunctionMeaninglet $para :=127Returns true if the string let $para :=70 contains let $para :=73 as a substring, taking collations into account. let $para :=605Returns true if the string let $para :=70 contains let $para :=73 as a leading substring, taking collations into account. let $para :=608Returns true if the string let $para :=70 contains let $para :=73 as a trailing substring, taking collations into account. let $para :=611Returns the part of let $para :=70 that precedes the first occurrence of let $para :=73, taking collations into account. let $para :=614Returns the part of let $para :=70 that follows the first occurrence of let $para :=73, taking collations into account. 5.5.1 fn:containsSummaryReturns true if the string let $para :=70 contains let $para :=73 as a substring, taking collations into account.Signatures let $para :=127( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 let $para :=127( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244, let $para :=128 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesIf the value of let $para :=70 or let $para :=73 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of let $para :=73 is the zero-length string, then the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. If the value of let $para :=70 is the zero-length string, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 indicating whether or not the value of let $para :=70 contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of let $para :=73, according to the collation that is used. Note: Minimal match is defined in [UTS #10]. Error ConditionsA dynamic error may be raised [err:FOCH0004] if the specified collation does not support collation units. ExamplesThe collation used in these examples, let $para :=649 is a collation in which both "-" and "*" are ignorable collation units. "Ignorable collation unit" is equivalent to "ignorable collation element" in [UTS #10]. The expression let $para :=650 returns let $para :=182. The expression let $para :=652 returns let $para :=184. The expression let $para :=654 returns let $para :=182. (The first rule is applied, followed by the second rule.) The expression let $para :=656 returns let $para :=182. The expression let $para :=658 returns let $para :=182. The expression let $para :=660 returns let $para :=182. The expression let $para :=662 returns let $para :=182. (The second argument contains only ignorable collation units and is equivalent to the zero-length string.) 5.5.2 fn:starts-withSummaryReturns true if the string let $para :=70 contains let $para :=73 as a leading substring, taking collations into account.Signatures let $para :=605( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 let $para :=605( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244, let $para :=128 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesIf the value of let $para :=70 or let $para :=73 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of let $para :=73 is the zero-length string, then the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. If the value of let $para :=70 is the zero-length string and the value of let $para :=73 is not the zero-length string, then the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 indicating whether or not the value of let $para :=70 starts with a sequence of collation units that provides a match to the collation units of let $para :=73 according to the collation that is used. Note: Match is defined in [UTS #10]. Error ConditionsA dynamic error may be raised [err:FOCH0004] if the specified collation does not support collation units. ExamplesThe collation used in these examples, let $para :=649 is a collation in which both "-" and "*" are ignorable collation units. "Ignorable collation unit" is equivalent to "ignorable collation element" in [UTS #10]. The expression let $para :=698 returns let $para :=182. The expression let $para :=700 returns let $para :=184. The expression let $para :=702 returns let $para :=182. The expression let $para :=704 returns let $para :=182. The expression let $para :=706 returns let $para :=182. The expression let $para :=708 returns let $para :=182. The expression let $para :=710 returns let $para :=182. (The second argument contains only ignorable collation units and is equivalent to the zero-length string.) The expression let $para :=712 returns let $para :=182. 5.5.3 fn:ends-withSummaryReturns true if the string let $para :=70 contains let $para :=73 as a trailing substring, taking collations into account.Signatures let $para :=608( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 let $para :=608( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244, let $para :=128 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesIf the value of let $para :=70 or let $para :=73 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of let $para :=73 is the zero-length string, then the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. If the value of let $para :=70 is the zero-length string and the value of let $para :=73 is not the zero-length string, then the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 indicating whether or not the value of let $para :=70 ends with a sequence of collation units that provides a match to the collation units of let $para :=73 according to the collation that is used. Note: Match is defined in [UTS #10]. Error ConditionsA dynamic error may be raised [err:FOCH0004] if the specified collation does not support collation units. ExamplesThe collation used in these examples, let $para :=649 is a collation in which both "-" and "*" are ignorable collation units. "Ignorable collation unit" is equivalent to "ignorable collation element" in [UTS #10]. The expression let $para :=748 returns let $para :=182. The expression let $para :=750 returns let $para :=184. The expression let $para :=752 returns let $para :=182. The expression let $para :=754 returns let $para :=182. The expression let $para :=756 returns let $para :=182. The expression let $para :=756 returns let $para :=182. The expression let $para :=760 returns let $para :=182. (The second argument contains only ignorable collation units and is equivalent to the zero-length string.) The expression let $para :=762 returns let $para :=182. 5.5.4 fn:substring-beforeSummaryReturns the part of let $para :=70 that precedes the first occurrence of let $para :=73, taking collations into account.Signatures let $para :=611( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244) let $para :=71 let $para :=10 let $para :=611( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=10Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesIf the value of let $para :=70 or let $para :=73 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of let $para :=73 is the zero-length string, then the function returns the zero-length string. If the value of let $para :=70 does not contain a string that is equal to the value of let $para :=73, then the function returns the zero-length string. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns the substring of the value of let $para :=70 that precedes in the value of let $para :=70 the first occurrence of a sequence of collation units that provides a minimal match to the collation units of let $para :=73 according to the collation that is used. Note: Minimal match is defined in [UTS #10]. Error ConditionsA dynamic error may be raised [err:FOCH0004] if the specified collation does not support collation units. ExamplesThe collation used in these examples, let $para :=649 is a collation in which both "-" and "*" are ignorable collation units. "Ignorable collation unit" is equivalent to "ignorable collation element" in [UTS #10]. The expression let $para :=796 returns let $para :=797. The expression let $para :=798 returns let $para :=044. The expression let $para :=800 returns let $para :=044. The expression let $para :=802 returns let $para :=803. The expression let $para :=804 returns let $para :=805. The expression let $para :=806 returns let $para :=807. The expression let $para :=808 returns let $para :=044. (The second argument contains only ignorable collation units and is equivalent to the zero-length string.) 5.5.5 fn:substring-afterSummaryReturns the part of let $para :=70 that follows the first occurrence of let $para :=73, taking collations into account.Signatures let $para :=614( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244) let $para :=71 let $para :=10 let $para :=614( let $para :=70 let $para :=71 let $para :=244, let $para :=73 let $para :=71 let $para :=244, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=10Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI. RulesIf the value of let $para :=70 or let $para :=73 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of let $para :=73 is the zero-length string, then the function returns the value of let $para :=70. If the value of let $para :=70 does not contain a string that is equal to the value of let $para :=73, then the function returns the zero-length string. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns the substring of the value of let $para :=70 that follows in the value of let $para :=70 the first occurrence of a sequence of collation units that provides a minimal match to the collation units of let $para :=73 according to the collation that is used. Note: Minimal match is defined in [UTS #10]. Error ConditionsA dynamic error may be raised [err:FOCH0004] if the specified collation does not support collation units. ExamplesThe collation used in these examples, let $para :=649 is a collation in which both "-" and "*" are ignorable collation units. "Ignorable collation unit" is equivalent to "ignorable collation element" in [UTS #10]. The expression let $para :=843 returns let $para :=844. The expression let $para :=845 returns let $para :=044. The expression let $para :=847 returns let $para :=044. The expression let $para :=849 returns let $para :=850. The expression let $para :=851 returns let $para :=852. The expression let $para :=853 returns let $para :=854. The expression let $para :=855 returns let $para :=856. (The second argument contains only ignorable collation units and is equivalent to the zero-length string.) 5.6 String functions that use regular expressionsThe three functions described in this section make use of a regular expression syntax for pattern matching. This is described below. FunctionMeaninglet $para :=857Returns true if the supplied string matches a given regular expression. let $para :=858Returns a string produced from the input string by replacing any substrings that match a given regular expression with a supplied replacement string. let $para :=859Returns a sequence of strings constructed by splitting the input wherever a separator is found; the separator is any substring that matches a given regular expression. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)18Analyzes a string using a regular expression, returning an XML structure that identifies which parts of the input string matched or failed to match the regular expression, and in the case of matched substrings, which substrings matched each capturing group in the regular expression. 5.6.1 Regular expression syntaxThe regular expression syntax used by these functions is defined in terms of the regular expression syntax specified in XML Schema (see [XML Schema Part 2: Datatypes Second Edition]), which in turn is based on the established conventions of languages such as Perl. However, because XML Schema uses regular expressions only for validity checking, it omits some facilities that are widely-used with languages such as Perl. This section, therefore, describes extensions to the XML Schema regular expressions syntax that reinstate these capabilities. Note: It is recommended that implementers consult [UTS #18] for information on using regular expression processing on Unicode characters. The regular expression syntax and semantics are identical to those defined in [XML Schema Part 2: Datatypes Second Edition] with the additions described in the following sub-sections. Note: In [Schema 1.1 Part 2] there are no substantive technical changes to the syntax or semantics of regular expressions relative to XSD 1.0, but a number of errors and ambiguities have been resolved. For example, the rules for the interpretation of hyphens within square brackets in a regular expression have been clarified; and the semantics of regular expressions are no longer tied to a specific version of Unicode. Implementers, even in cases where XSD 1.1 is not supported, are advised to consult the XSD 1.1 regular expression specification for guidance on how to handle cases where the XSD 1.0 specification is unclear or inconsistent. 5.6.1.1 Matching the Start and End of the StringTwo meta-characters, let $para :=861 and let $para :=734 are added. By default, the meta-character let $para :=861 matches the start of the entire string, while let $para :=734 matches the end of the entire string. In multi-line mode, let $para :=861 matches the start of any line (that is, the start of the entire string, and the position immediately after a newline character), while let $para :=734 matches the end of any line (that is, the end of the entire string, and the position immediately before a newline character). Newline here means the character let $para :=867 only. This means that the production in [XML Schema Part 2: Datatypes Second Edition]: let $para :=868 is modified to read: let $para :=869 The XSD 1.1 grammar for regular expressions uses the same production rule, but renumbered and renamed let $para :=870; it is affected in the same way. The characters let $para :=871 and let $para :=872 correspond to " let $para :=873" and " let $para :=874" respectively. Note: The definition of Char (production [10]) in [XML Schema Part 2: Datatypes Second Edition] has a known error in which it omits the left brace ("{") and right brace ("}"). That error is corrected here. The following production: let $para :=875 is modified to read: let $para :=876 Using XSD 1.1 as the baseline the equivalent is to change the production: let $para :=877 to read: let $para :=878 Single character escapes are extended to allow the let $para :=734 character to be escaped. The following production is changed: let $para :=880 to let $para :=881 (In the XSD 1.1 version of the regular expression grammar, the production rule for let $para :=882 is unchanged, but is renumbered [84]) 5.6.1.2 Reluctant QuantifiersReluctant quantifiers are supported. They are indicated by a let $para :=11 following a quantifier. Specifically:
The effect of these quantifiers is that the regular expression matches the shortest possible substring consistent with the match as a whole succeeding. Without the let $para :=11 , the regular expression matches the longest possible substring. To achieve this, the production in [XML Schema Part 2: Datatypes Second Edition]: let $para :=891 is changed to: let $para :=892 (In the XSD 1.1 version of the regular expression grammar, this rule is unchanged, but is renumbered [67]) Note: Reluctant quantifiers have no effect on the results of the boolean let $para :=857 function, since this function is only interested in discovering whether a match exists, and not where it exists. 5.6.1.3 Captured Sub-ExpressionsSub-expressions (groups) within the regular expression are recognized. The regular expression syntax defined by [XML Schema Part 2: Datatypes Second Edition] allows a regular expression to contain parenthesized sub-expressions, but attaches no special significance to them. Some operations associated with regular expressions (for example, back-references, and the let $para :=858 function) allow access to the parts of the input string that matched a sub-expression (called captured substrings). [Definition] A left parenthesis is recognized as a capturing left parenthesis provided it is not immediately followed by More specifically, the ·capturing sub-expression· enclosed by the Nth capturing left parenthesis within the regular expression (determined by its character position in left-to-right order, and counting from one) is referred to as the Nth capturing sub-expression. For example, in the regular expression let $para :=896, the string matched by the sub-expression let $para :=897 is capturing sub-expression 1, the string matched by let $para :=898 is capturing sub-expression 2, and the string matched by let $para :=899 is capturing sub-expression 3. When, in the course of evaluating a regular expression, a particular substring of the input matches a capturing sub-expression, that substring becomes available as a captured substring. The string matched by the Nth capturing sub-expression is referred to as the Nth captured substring. By convention, the substring captured by the entire regular expression is treated as captured substring 0 (zero). When a ·capturing sub-expression· is matched more than once (because it is within a construct that allows repetition), then only the last substring that it matched will be captured. Note that this rule is not sufficient in all cases to ensure an unambiguous result, especially in cases where (a) the regular expression contains nested repeating constructs, and/or (b) the repeating construct matches a zero-length string. In such cases it is implementation-dependent which substring is captured. For example given the regular expression let $para :=900 and the input string let $para :=901, an implementation might legitimately capture either let $para :=901 or a zero length string as the content of the captured subgroup. Parentheses that are required to group terms within the regular expression, but which are not required for capturing of substrings, can be represented using the syntax let $para :=903. To achieve this, the production rule for let $para :=904 in [XML Schema Part 2: Datatypes Second Edition] is changed to replace the alternative: let $para :=905 with: let $para :=906 (For the new versions of the XSD 1.0 and XSD 1.1 production rules for let $para :=904, see below.) In the absence of back-references (see below), the presence of the optional let $para :=895 has no effect on the set of strings that match the regular expression, but causes the left parenthesis not to be counted by operations (such as let $para :=858 and back-references) that number the capturing sub-expressions within a regular expression. 5.6.1.4 Back-ReferencesBack-references are allowed outside a character class expression. A back-reference is an additional kind of atom. The construct let $para :=910 where let $para :=911 is a single digit is always recognized as a back-reference; if this is followed by further digits, these digits are taken to be part of the back-reference if and only if the resulting number NN is such that the back-reference is preceded by the opening parenthesis of the NNth capturing left parenthesis. The regular expression is invalid if a back-reference refers to a capturing sub-expression that does not exist or whose closing right parenthesis occurs after the back-reference. A back-reference with number N matches a string that is the same as the value of the let $para :=911th captured substring. For example, the regular expression let $para :=913 matches a sequence of characters delimited either by an apostrophe at the start and end, or by a quotation mark at the start and end. If no string has been matched by the let $para :=911th capturing sub-expression, the back-reference is interpreted as matching a zero-length string. Combining this change with the introduction of non-capturing groups (see above), back-references change the following production: let $para :=915 to let $para :=916 let $para :=917 With respect to the XSD 1.1 version of the regular expression grammar, the effect is to change: let $para :=918 to let $para :=919 let $para :=920 Note: Within a character class expression, let $para :=921 followed by a digit is invalid. Some other regular expression languages interpret this as an octal character reference. 5.6.1.5 Unicode Block NamesA regular expression that uses a Unicode block name that is not defined in the version(s) of Unicode supported by the processor (for example let $para :=922) is deemed to be invalid [err:FORX0002]. Note: XSD 1.0 does not say how this situation should be handled; XSD 1.1 says that it should be handled by treating all characters as matching. 5.6.2 FlagsAll these functions provide an optional parameter, let $para :=923, to set options for the interpretation of the regular expression. The parameter accepts a let $para :=10, in which individual letters are used to set options. The presence of a letter within the string indicates that the option is on; its absence indicates that the option is off. Letters may appear in any order and may be repeated. If there are characters present that are not defined here as flags, then a dynamic error is raised [err:FORX0001]. The following options are defined:
5.6.3 fn:matchesSummaryReturns true if the supplied string matches a given regular expression. Signatureslet $para :=857( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 let $para :=857( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10, let $para :=923 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of calling the first version of this function (omitting the argument let $para :=923) is the same as the effect of calling the second version with the let $para :=923 argument set to a zero-length string. Flags are defined in 5.6.2 Flags. If let $para :=232 is the empty sequence, it is interpreted as the zero-length string. The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if let $para :=232 or some substring of let $para :=232 matches the regular expression supplied as let $para :=981. Otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The matching rules are influenced by the value of let $para :=923 if present.Error Conditions A dynamic error is raised [err:FORX0002] if the value of let $para :=981 is invalid according to the rules described in 5.6.1 Regular expression syntax. A dynamic error is raised [err:FORX0001] if the value of let $para :=923 is invalid according to the rules described in 5.6.2 Flags.Notes Unless the metacharacters let $para :=861 and let $para :=734 are used as anchors, the string is considered to match the pattern if any substring matches the pattern. But if anchors are used, the anchors must match the start/end of the string (in string mode), or the start/end of a line (in multi-line mode). This is different from the behavior of patterns in [XML Schema Part 2: Datatypes Second Edition], where regular expressions are implicitly anchored. Regular expression matching is defined on the basis of Unicode code points; it takes no account of collations. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)011 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)013 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)015 returns let $para :=184. Given the source document: let $para :=4 the following function calls produce the following results, with the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)017 element as the context node: The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)018 returns let $para :=184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)020 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)022 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)024 returns let $para :=184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)026 returns let $para :=182. 5.6.4 fn:replaceSummaryReturns a string produced from the input string by replacing any substrings that match a given regular expression with a supplied replacement string. Signatureslet $para :=858( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)035 let $para :=71 let $para :=10) let $para :=71 let $para :=10 let $para :=858( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)035 let $para :=71 let $para :=10, let $para :=923 let $para :=71 let $para :=10) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of calling the first version of this function (omitting the argument let $para :=923) is the same as the effect of calling the second version with the let $para :=923 argument set to a zero-length string. Flags are defined in 5.6.2 Flags. The let $para :=923 argument is interpreted in the same manner as for the let $para :=857 function. If let $para :=232 is the empty sequence, it is interpreted as the zero-length string. The function returns the let $para :=10 that is obtained by replacing each non-overlapping substring of let $para :=232 that matches the given let $para :=981 with an occurrence of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)035 string. If two overlapping substrings of let $para :=232 both match the let $para :=981, then only the first one (that is, the one whose first ·character· comes first in the let $para :=232 string) is replaced. If the let $para :=959 flag is present, the replacement string is used as is. Otherwise, within the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)035 string, a variable Primo Secondo Terzo Quarto Quinto ...98 may be used to refer to the substring captured by the Nth parenthesized sub-expression in the regular expression. For each match of the pattern, these variables are assigned the value of the content matched by the relevant sub-expression, and the modified replacement string is then substituted for the ·characters· in let $para :=232 that matched the pattern. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)071 refers to the substring captured by the regular expression as a whole. More specifically, the rules are as follows, where op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)072 is the number of parenthesized sub-expressions in the regular expression, and let $para :=911 is the decimal number formed by taking all the digits that consecutively follow the let $para :=734 character:
For example, if the replacement string is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)090 and there are 5 substrings, the result contains the value of the substring that matches the second sub-expression, followed by the digit declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. Unless the let $para :=959 flag is used, a literal let $para :=734 character within the replacement string must be written as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)094, and a literal let $para :=921 character must be written as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)096. If two alternatives within the pattern both match at the same position in the let $para :=232, then the match that is chosen is the one matched by the first alternative. For example: let $para :=5Error Conditions A dynamic error is raised [err:FORX0002] if the value of let $para :=981 is invalid according to the rules described in section 5.6.1 Regular expression syntax. A dynamic error is raised [err:FORX0001] if the value of let $para :=923 is invalid according to the rules described in section 5.6.2 Flags. A dynamic error is raised [err:FORX0003] if the pattern matches a zero-length string, that is, if the expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)100 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. It is not an error, however, if a captured substring is zero-length. In the absence of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)035 contains a dollar sign ( let $para :=734) character that is not immediately followed by a digit op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)105 and not immediately preceded by a backslash ( let $para :=921). In the absence of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)035 contains a backslash ( let $para :=921) character that is not part of a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)096 pair, unless it is immediately followed by a dollar sign ( let $para :=734) character.Notes If the input string contains no substring that matches the regular expression, the result of the function is a single string identical to the input string. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)112 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)113. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)114 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)115. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)116 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)117. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)118 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)119. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)120 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)121. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)122 raises an error, because the pattern matches the zero-length string The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)123 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)124. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)125 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)126. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)127 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)128. (The first op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)129 is replaced.) 5.6.5 fn:tokenizeSummaryReturns a sequence of strings constructed by splitting the input wherever a separator is found; the separator is any substring that matches a given regular expression. Signatureslet $para :=859( let $para :=232 let $para :=71 let $para :=244) let $para :=71 let $para :=234 let $para :=859( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10) let $para :=71 let $para :=234 let $para :=859( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10, let $para :=923 let $para :=71 let $para :=10) let $para :=71 let $para :=234Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe one-argument form of this function splits the supplied string at whitespace boundaries. More specifically, calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)157 is equivalent to calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)158 where the second argument is a single space character (x20). The effect of calling the two-argument form of this function (omitting the argument let $para :=923) is the same as the effect of calling the three-argument version with the let $para :=923 argument set to a zero-length string. Flags are defined in 5.6.2 Flags. The following rules apply to the three-argument form of the function:
A dynamic error is raised [err:FORX0002] if the value of let $para :=981 is invalid according to the rules described in section 5.6.1 Regular expression syntax. A dynamic error is raised [err:FORX0001] if the value of let $para :=923 is invalid according to the rules described in section 5.6.2 Flags. A dynamic error is raised [err:FORX0003] if the supplied let $para :=981 matches a zero-length string, that is, if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)100 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.Notes If the input string is not zero length, and no separators are found in the input string, the result of the function is a single string identical to the input string. The one-argument form of the function has a similar effect to the two-argument form with op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)177 as the separator pattern, except that the one-argument form strips leading and trailing whitespace, whereas the two-argument form delivers an extra zero-length token if leading or trailing whitespace is present. The function returns no information about the separators that were found in the string. If this information is required, the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)18 function can be used instead. The separator used by the one-argument form of the function is any sequence of tab (x09), newline (x0A), carriage return (x0D) or space (x20) characters. This is the same as the separator recognized by list-valued attributes as defined in XSD. It is not the same as the separator recognized by list-valued attributes in HTML5, which also treats form-feed (x0C) as whitespace. If it is necessary to treat form-feed as a separator, an explicit separator pattern should be used. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)179 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)180. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)181 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)183 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)185 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)186. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)187 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)188. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)189 raises the dynamic error [err:FORX0003]. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)190 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)191. 5.6.6 fn:analyze-stringSummaryAnalyzes a string using a regular expression, returning an XML structure that identifies which parts of the input string matched or failed to match the regular expression, and in the case of matched substrings, which substrings matched each capturing group in the regular expression. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)18( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)200 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)18( let $para :=232 let $para :=71 let $para :=244, let $para :=981 let $para :=71 let $para :=10, let $para :=923 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)200Properties This function is ·nondeterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of calling the first version of this function (omitting the argument let $para :=923) is the same as the effect of calling the second version with the let $para :=923 argument set to a zero-length string. Flags are defined in 5.6.2 Flags. The let $para :=923 argument is interpreted in the same way as for the let $para :=857 function. If let $para :=232 is the empty sequence the function behaves as if let $para :=232 were the zero-length string. In this situation the result will be an element node with no children. The function returns an element node whose local name is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)219. This element and all its descendant elements have the namespace URI let $para :=37. The namespace prefix is ·implementation-dependent·. The children of this element are a sequence of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)221 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)222 elements. This sequence is formed by breaking the let $para :=232 string into a sequence of strings, returning any substring that matches let $para :=981 as the content of a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)225 element, and any intervening substring as the content of a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)226 element. More specifically, the function starts at the beginning of the input string and attempts to find the first substring that matches the regular expression. If there are several matches, the first match is defined to be the one whose starting position comes first in the string. If several alternatives within the regular expression both match at the same position in the input string, then the match that is chosen is the first alternative that matches. For example, if the input string is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)227 and the regular expression is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)228, then the match that is chosen is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)229. Having found the first match, the instruction proceeds to find the second and subsequent matches by repeating the search, starting at the first ·character· that was not included in the previous match. The input string is thus partitioned into a sequence of substrings, some of which match the regular expression, others which do not match it. Each substring will contain at least one character. This sequence is represented in the result by the sequence of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)221 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)222 children of the returned element node; the string value of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)221 or op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)222 element will be the corresponding substring of let $para :=232, and the string value of the returned element node will therefore be the same as let $para :=232. The content of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)222 element is always a single text node. The content of a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)221 element, however, is in general a sequence of text nodes and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)238 element children. An op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)238 element with a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)240 attribute having the integer value N identifies the substring captured by the Nth parenthesized sub-expression in the regular expression. For each capturing subexpression there will be at most one corresponding op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)238 element in each op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)221 element in the result. If the function is called twice with the same arguments, it is ·implementation-dependent· whether the two calls return the same element node or distinct (but deep equal) element nodes. In this respect it is ·non-deterministic with respect to node identity·. The base URI of the element nodes in the result is ·implementation-dependent·. A schema is defined for the structure of the returned element: see C.1 Schema for the result of fn:analyze-string. The result of the function will always be such that validation against this schema would succeed. However, it is ·implementation-defined· whether the result is typed or untyped, that is, whether the elements and attributes in the returned tree have type annotations that reflect the result of validating against this schema. Error ConditionsA dynamic error is raised [err:FORX0002] if the value of let $para :=981 is invalid according to the rules described in section 5.6.1 Regular expression syntax. A dynamic error is raised [err:FORX0001] if the value of let $para :=923 is invalid according to the rules described in section 5.6.2 Flags. A dynamic error is raised [err:FORX0003] if the supplied let $para :=981 matches a zero-length string, that is, if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)100 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.Notes It is recommended that a processor that implements schema awareness should return typed nodes. The concept of "schema awareness", however, is a matter for host languages to define and is outside the scope of the function library specification. The declarations and definitions in the schema are not automatically available in the static context of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)18 call (or of any other expression). The contents of the static context are host-language defined, and in some host languages are implementation-defined. The schema defines the outermost element, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)219, in such a way that mixed content is permitted. In fact the element will only have element nodes ( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)225 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)226) as its children, never text nodes. Although this might have originally been an oversight, defining the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)219 element with op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)253 allows it to be atomized, which is potentially useful (the atomized value will be the original input string), and the capability has therefore been retained for compatibility with the 3.0 version of this specification.Examples In the following examples, the result document is shown in serialized form, with whitespace between the element nodes. This whitespace is not actually present in the result. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)254 returns (with whitespace added for legibility): let $para :=7 The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)255 returns (with whitespace added for legibility): let $para :=8 The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)256 returns (with whitespace added for legibility): let $para :=9 6 Functions that manipulate URIsThis section specifies functions that manipulate URI values, either as instances of let $para :=30 or as strings.FunctionMeaning op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)258Resolves a relative IRI reference against an absolute IRI. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)259Encodes reserved characters in a string that is intended to be used in the path segment of a URI. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)260Converts a string containing an IRI into a URI according to the rules of [RFC 3987]. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)261Escapes a URI in the same way that HTML user agents handle attribute values expected to contain URIs. 6.1 fn:resolve-uriSummaryResolves a relative IRI reference against an absolute IRI. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)258( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)263 let $para :=71 let $para :=244) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)258( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)263 let $para :=71 let $para :=244, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)272 let $para :=71 let $para :=10) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function is defined to operate on IRI references as defined in [RFC 3987], and the implementation must permit all arguments that are valid according to that specification. In addition, the implementation may accept some or all strings that conform to the rules for (absolute or relative) Legacy Extended IRI references as defined in [Legacy extended IRIs for XML resource identification]. For the purposes of this section, the terms IRI and IRI reference include these extensions, insofar as the implementation chooses to support them. The following rules apply in order:
The first form of this function resolves op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)263 against the value of the base-uri property from the static context. A dynamic error is raised [err:FONS0005] if the base-uri property is not initialized in the static context. A dynamic error is raised [err:FORG0002] if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)263 is not a valid IRI according to the rules of RFC3987, extended with an implementation-defined subset of the extensions permitted in LEIRI, or if it is not a suitable relative reference to use as input to the RFC3986 resolution algorithm extended to handle additional unreserved characters. A dynamic error is raised [err:FORG0002] if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)272 is not a valid IRI according to the rules of RFC3987, extended with an implementation-defined subset of the extensions permitted in LEIRI, or if it is not a suitable IRI to use as input to the chosen resolution algorithm (for example, if it is a relative IRI reference, if it is a non-hierarchic URI, or if it contains a fragment identifier). A dynamic error is raised [err:FORG0009] if the chosen resolution algorithm fails for any other reason. NotesResolving a URI does not dereference it. This is merely a syntactic operation on two ·strings·. The algorithms in the cited RFCs include some variations that are optional or recommended rather than mandatory; they also describe some common practices that are not recommended, but which are permitted for backwards compatibility. Where the cited RFCs permit variations in behavior, so does this specification. Throughout this family of specifications, the phrase "resolving a relative URI (or IRI) reference" should be understood as using the rules of this function, unless otherwise stated. RFC3986 defines an algorithm for resolving relative references in the context of the URI syntax defined in that RFC. RFC3987 describes a modification to that algorithm to make it applicable to IRIs (specifically: additional characters permitted in an IRI are handled the same way that RFC3986 handles unreserved characters). The LEIRI specification does not explicitly define a resolution algorithm, but suggests that it should not be done by converting the LEIRI to a URI, and should not involve percent-encoding. This specification fills this gap by defining resolution for LEIRIs in the same way that RFC3987 defines resolution for IRIs, that is by specifying that additional characters are handled as unreserved characters. 6.2 fn:encode-for-uriSummaryEncodes reserved characters in a string that is intended to be used in the path segment of a URI. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)259( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)287 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)287 is the empty sequence, the function returns the zero-length string. This function applies the URI escaping rules defined in section 2 of [RFC 3986] to the let $para :=10 supplied as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)287. The effect of the function is to escape reserved characters. Each such character in the string is replaced with its percent-encoded form as described in [RFC 3986]. Since [RFC 3986] recommends that, for consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings, this function must always generate hexadecimal values using the upper-case letters A-F. NotesAll characters are escaped except those identified as "unreserved" by [RFC 3986], that is the upper- and lower-case letters A-Z, the digits 0-9, HYPHEN-MINUS ("-"), LOW LINE ("_"), FULL STOP ".", and TILDE "~". This function escapes URI delimiters and therefore cannot be used indiscriminately to encode "invalid" characters in a path segment. This function is invertible but not idempotent. This is because a string containing a percent character will be modified by applying the function: for example op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)295 becomes op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)296, while op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)296 becomes op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)298.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)299 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)300. (This is probably not what the user intended because all of the delimiters have been encoded.) The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)301 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)302. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)303 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)304. 6.3 fn:iri-to-uriSummaryConverts a string containing an IRI into a URI according to the rules of [RFC 3987]. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)260( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)306 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)306 is the empty sequence, the function returns the zero-length string. Otherwise, the function converts the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)306 into a URI according to the rules given in Section 3.1 of [RFC 3987] by percent-encoding characters that are allowed in an IRI but not in a URI. If op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)306 contains a character that is invalid in an IRI, such as the space character (see note below), the invalid character is replaced by its percent-encoded form as described in [RFC 3986] before the conversion is performed. Since [RFC 3986] recommends that, for consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings, this function must always generate hexadecimal values using the upper-case letters A-F. NotesThe function is idempotent but not invertible. Both the inputs op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)314 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)315 will be converted to the output op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)315. This function does not check whether op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)306 is a valid IRI. It treats it as an ·string· and operates on the ·characters· in the string. The following printable ASCII characters are invalid in an IRI: "<", ">", " " " (double quote), space, "{", "}", "|", "\", "^", and "`". Since these characters should not appear in an IRI, if they do appear in op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)306 they will be percent-encoded. In addition, characters outside the range x20-x7E will be percent-encoded because they are invalid in a URI. Since this function does not escape the PERCENT SIGN "%" and this character is not allowed in data within a URI, users wishing to convert character strings (such as file names) that include "%" to a URI should manually escape "%" by replacing it with "%25". ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)319 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)320. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)321 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)302. 6.4 fn:escape-html-uriSummaryEscapes a URI in the same way that HTML user agents handle attribute values expected to contain URIs. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)261( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 let $para :=71 let $para :=244) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 is the empty sequence, the function returns the zero-length string. Otherwise, the function escapes all ·characters· except printable characters of the US-ASCII coded character set, specifically the ·codepoints· between 32 and 126 (decimal) inclusive. Each character in op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 to be escaped is replaced by an escape sequence, which is formed by encoding the character as a sequence of octets in UTF-8, and then representing each of these octets in the form %HH, where HH is the hexadecimal representation of the octet. This function must always generate hexadecimal values using the upper-case letters A-F.Notes The behavior of this function corresponds to the recommended handling of non-ASCII characters in URI attribute values as described in [HTML 4.0] Appendix B.2.1. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)331 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)332. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)333 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)334. 7 Functions and operators on Boolean valuesThis section defines functions and operators on the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 datatype. 7.1 Boolean constant functionsSince no literals are defined in XPath to reference the constant boolean values true and false, two functions are provided for the purpose. FunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)336Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)339Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 value let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 7.1.1 fn:trueSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)336() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe result is equivalent to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)347.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)348 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)349. 7.1.2 fn:falseSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 value let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)339() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe result is equivalent to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)355.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)356 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)357. 7.2 Operators on Boolean valuesThe following functions define the semantics of operators on boolean values in [XQuery 3.1: An XML Query Language] and [XML Path Language (XPath) 3.1]: FunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)358Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the two arguments are the same boolean value. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)360Returns true if the first argument is false and the second is true. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)361Returns true if the first argument is true and the second is false. The ordering operators op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)360 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)361 are provided for application purposes and for compatibility with [XML Path Language (XPath) Version 1.0]. The [XML Schema Part 2: Datatypes Second Edition] datatype op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 is not ordered. 7.2.1 op:boolean-equalSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the two arguments are the same boolean value.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)358( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)368 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)371 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if both arguments are op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 or if both arguments are let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. It returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 if one of the arguments is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 and the other argument is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 7.2.2 op:boolean-less-thanSummaryReturns true if the first argument is false and the second is true. Operator MappingDefines the semantics of the "lt" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 values. Also used in the definition of the "ge" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)360( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if let $para :=70 is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 and let $para :=73 is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. Otherwise, it returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 7.2.3 op:boolean-greater-thanSummaryReturns true if the first argument is true and the second is false. Operator MappingDefines the semantics of the "gt" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 values. Also used in the definition of the "le" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)361( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function call op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)408 is defined to return the same result as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)409 7.3 Functions on Boolean valuesThe following functions are defined on boolean values: FunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)410Computes the effective boolean value of the sequence let $para :=25. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)412Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the effective boolean value of let $para :=25 is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 if it is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. 7.3.1 fn:booleanSummaryComputes the effective boolean value of the sequence let $para :=25.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)410( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function computes the effective boolean value of a sequence, defined according to the following rules. See also Section 2.4.3 Effective Boolean Value XP31.
In all cases other than those listed above, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)410 raises a type error [err:FORG0006].Notes The result of this function is not necessarily the same as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)451. For example, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)452 returns the value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 whereas op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)454 (which can also be written op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)455) returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07.Examples let $para :=0 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)457 raises a type error [err:FORG0006]. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)458 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)460 returns let $para :=184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)462 returns let $para :=184. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)464 raises a type error [err:FORG0006]. 7.3.2 fn:notSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the effective boolean value of let $para :=25 is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 if it is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)412( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe value of let $para :=25 is first reduced to an effective boolean value by applying the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)477 function. The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the effective boolean value is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 if the effective boolean value is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)482 returns let $para :=184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)484 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)486 returns let $para :=184. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)488 raises a type error [err:FORG0006]. 8 Functions and operators on durationsOperators are defined on the following type:
and on the two defined subtypes (see 8.1 Two totally ordered subtypes of duration):
No ordering relation is defined on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 values. Two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 values may however be compared for equality. Operations on durations (including equality comparison, casting to string, and extraction of components) all treat the duration as normalized. This means that the seconds and minutes components will always be less than 60, the hours component less than 24, and the months component less than 12. Thus, for example, a duration of 120 seconds always gives the same result as a duration of two minutes. Conditions such as underflow and overflow may occur with arithmetic on durations: see 9.7.1 Limits and precision Note: This means that in practice, the information content of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 value can be reduced to an let $para :=85 number of months, and an let $para :=82 number of seconds. For the two defined subtypes this is further simplified so that one of these two components is fixed at zero. Operations such as comparison of durations and arithmetic on durations can be expressed in terms of numeric operations applied to these two components. 8.1 Two totally ordered subtypes of durationTwo subtypes of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489, namely let $para :=24 and let $para :=25, are defined in [Schema 1.1 Part 2]. These types must be available in the data model whether or not the implementation supports other aspects of XSD 1.1. The significance of these subtypes is that arithmetic and ordering become well defined; this is not the case for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 values in general, because of the variable number of days in a month. For this reason, many of the functions and operators on durations require the arguments/operands to belong to these two subtypes. 8.2 Comparison operators on durationsFunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)498Returns true if let $para :=70 is a shorter duration than let $para :=73. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)501Returns true if let $para :=70 is a longer duration than let $para :=73. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)504Returns true if let $para :=70 is a shorter duration than let $para :=73. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)507Returns true if let $para :=70 is a longer duration than let $para :=73. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)510Returns true if let $para :=70 and let $para :=73 are durations of the same length. The following comparison operators are defined on the [XML Schema Part 2: Datatypes Second Edition] duration datatypes. Each operator takes two operands of the same type and returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 result. As discussed in [XML Schema Part 2: Datatypes Second Edition], the order relation on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 is a partial order rather than a total order. For this reason, only equality is defined on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489. A full complement of comparison and arithmetic functions are defined on the two subtypes of duration described in 8.1 Two totally ordered subtypes of duration which do have a total order. 8.2.1 op:yearMonthDuration-less-thanSummaryReturns true if let $para :=70 is a shorter duration than let $para :=73.Operator Mapping Defines the semantics of the "lt" operator when applied to two let $para :=24 values. Also used in the definition of the "ge" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)498( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=24) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules If the number of months in the value of let $para :=70 is numerically less than the number of months in the value of let $para :=73, the function returns true. Otherwise, the function returns false. NotesEither or both durations may be negative. 8.2.2 op:yearMonthDuration-greater-thanSummaryReturns true if let $para :=70 is a longer duration than let $para :=73.Operator Mapping Defines the semantics of the "gt" operator when applied to two let $para :=24 values. Also used in the definition of the "le" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)501( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=24) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function call op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)542 is defined to return the same result as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)543 8.2.3 op:dayTimeDuration-less-thanSummaryReturns true if let $para :=70 is a shorter duration than let $para :=73.Operator Mapping Defines the semantics of the "lt" operator when applied to two let $para :=25 values. Also used in the definition of the "ge" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)504( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=25) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules If the number of seconds in the value of let $para :=70 is numerically less than the number of seconds in the value of let $para :=73, the function returns true. Otherwise, the function returns false. NotesEither or both durations may be negative 8.2.4 op:dayTimeDuration-greater-thanSummaryReturns true if let $para :=70 is a longer duration than let $para :=73.Operator Mapping Defines the semantics of the "gt" operator when applied to two let $para :=25 values. Also used in the definition of the "le" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)507( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=25) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function call op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)570 is defined to return the same result as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)571 8.2.5 op:duration-equalSummaryReturns true if let $para :=70 and let $para :=73 are durations of the same length.Operator Mapping Defines the semantics of the "eq" operators when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 values. Also used in the definition of the "ne" operator.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)510( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules If the let $para :=24 components of let $para :=70 and let $para :=73 are equal and the let $para :=25 components of let $para :=70 and let $para :=73 are equal, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. Otherwise, the function returns false. The semantics of this function are: let $para :=1 that is, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the months and seconds values of the two durations are equal.Notes Note that this function, like any other, may be applied to arguments that are derived from the types given in the function signature, including the two subtypes let $para :=25 and let $para :=24. With the exception of the zero-length duration, no instance of let $para :=25 can ever be equal to an instance of let $para :=24.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)596 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)598 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)600 returns let $para :=184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)602 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)604 returns let $para :=184. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)606 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)608 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)610 returns let $para :=182. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)612 returns let $para :=182. 8.3 Component extraction functions on durationsThe duration datatype may be considered to be a composite datatypes in that it contains distinct properties or components. The extraction functions specified below extract a single component from a duration value. For op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 and its subtypes, including the two subtypes let $para :=24 and let $para :=25, the components are normalized: this means that the seconds and minutes components will always be less than 60, the hours component less than 24, and the months component less than 12.FunctionMeaning op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)617Returns the number of years in a duration. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)618Returns the number of months in a duration. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)619Returns the number of days in a duration. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)620Returns the number of hours in a duration. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)621Returns the number of minutes in a duration. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)622Returns the number of seconds in a duration. 8.3.1 fn:years-from-durationSummaryReturns the number of years in a duration. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)617( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)626) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the years component in the value of let $para :=25. Given that a duration is a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)632 tuple, the result is the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)633. If let $para :=25 is a negative duration then the result will be negative. If let $para :=25 is an let $para :=25 the function returns 0.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)637 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)638. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)639 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);09. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)641 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 8.3.2 fn:months-from-durationSummaryReturns the number of months in a duration. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)618( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)626) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the months component in the value of let $para :=25. Given that a duration is a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)632 tuple, the result is the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)653. If let $para :=25 is a negative duration then the result will be negative. If let $para :=25 is an let $para :=25 the function returns 0.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)657 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)659 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)660. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)661 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 8.3.3 fn:days-from-durationSummaryReturns the number of days in a duration. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)619( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)626) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the days component in the value of let $para :=25. Given that a duration is a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)632 tuple, the result is the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)673. If let $para :=25 is a negative duration then the result will be negative. If let $para :=25 is an let $para :=24 the function returns 0.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)677 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)679 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)681 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 8.3.4 fn:hours-from-durationSummaryReturns the number of hours in a duration. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)620( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)626) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the hours component in the value of let $para :=25. Given that a duration is a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)632 tuple, the result is the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)693. If let $para :=25 is a negative duration then the result will be negative. If let $para :=25 is an let $para :=24 the function returns 0.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)697 returns let $para :=054. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)699 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)700. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)701 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)703 returns let $para :=034. 8.3.5 fn:minutes-from-durationSummaryReturns the number of minutes in a duration. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)621( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)626) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the minutes component in the value of let $para :=25. Given that a duration is a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)632 tuple, the result is the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)715. If let $para :=25 is a negative duration then the result will be negative. If let $para :=25 is an let $para :=24 the function returns 0.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)719 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)721 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)722. 8.3.6 fn:seconds-from-durationSummaryReturns the number of seconds in a duration. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)622( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)626) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)728Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=82 representing the seconds component in the value of let $para :=25. Given that a duration is a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)632 tuple, the result is the value of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)733 as an let $para :=82. If let $para :=25 is a negative duration then the result will be negative. If let $para :=25 is an let $para :=24 the function returns 0.Examples The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)738 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)739. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)740 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)741. 8.4 Arithmetic operators on durationsFunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)742Returns the result of adding two let $para :=24 values. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)744Returns the result of subtracting one let $para :=24 value from another. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)746Returns the result of multiplying the value of let $para :=70 by let $para :=73. The result is rounded to the nearest month. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)749Returns the result of dividing the value of let $para :=70 by let $para :=73. The result is rounded to the nearest month. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)752Returns the ratio of two let $para :=24 values. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)754Returns the sum of two let $para :=25 values. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)756Returns the result of subtracting one let $para :=25 from another. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)758Returns the result of multiplying a let $para :=25 by a number. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)760Returns the result of multiplying a let $para :=25 by a number. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)762Returns the ratio of two let $para :=25 values, as a decimal number. For operators that combine a duration and a date/time value, see 9.7 Arithmetic operators on durations, dates and times. 8.4.1 op:add-yearMonthDurationsSummaryReturns the result of adding two let $para :=24 values.Operator Mapping Defines the semantics of the "+" operator when applied to two let $para :=24 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)742( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=24) let $para :=71 let $para :=24Rules The function returns the result of adding the value of let $para :=70 to the value of let $para :=73. The result will be an let $para :=24 whose length in months is equal to the length in months of let $para :=70 plus the length in months of let $para :=73. For handling of overflow, see 9.7.1 Limits and precision. NotesEither duration (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)780 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)781. 8.4.2 op:subtract-yearMonthDurationsSummaryReturns the result of subtracting one let $para :=24 value from another.Operator Mapping Defines the semantics of the "-" operator when applied to two let $para :=24 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)744( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=24) let $para :=71 let $para :=24Rules The function returns the result of subtracting the value of let $para :=73 from the value of let $para :=70. The result will be an let $para :=24 whose length in months is equal to the length in months of let $para :=70 minus the length in months of let $para :=73. For handling of overflow, see 9.7.1 Limits and precision. NotesEither duration (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)798 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)799. 8.4.3 op:multiply-yearMonthDurationSummaryReturns the result of multiplying the value of let $para :=70 by let $para :=73. The result is rounded to the nearest month.Operator Mapping Defines the semantics of the "*" operator when applied to an let $para :=24 and a numeric value.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)746( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=26) let $para :=71 let $para :=24Rules The result is the let $para :=24 whose length in months is equal to the result of applying the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'82 function to the value obtained by multiplying the length in months of let $para :=70 by the value of let $para :=73. If let $para :=73 is positive or negative zero, the result is a zero-length duration. If let $para :=73 is positive or negative infinity, the result overflows and is handled as described in 9.7.1 Limits and precision. For handling of overflow and underflow, see 9.7.1 Limits and precision. Error ConditionsA dynamic error is raised [err:FOCA0005] if let $para :=73 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Notes Either duration (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)820 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)821. 8.4.4 op:divide-yearMonthDurationSummaryReturns the result of dividing the value of let $para :=70 by let $para :=73. The result is rounded to the nearest month.Operator Mapping Defines the semantics of the "div" operator when applied to an let $para :=24 and a numeric value.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)749( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=26) let $para :=71 let $para :=24Rules The result is the let $para :=24 whose length in months is equal to the result of applying the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'82 function to the value obtained by dividing the length in months of let $para :=70 by the value of let $para :=73. If let $para :=73 is positive or negative infinity, the result is a zero-length duration. If let $para :=73 is positive or negative zero, the result overflows and is handled as described in 9.7.1 Limits and precision. For handling of overflow and underflow, see 9.7.1 Limits and precision. Error ConditionsA dynamic error is raised [err:FOCA0005] if let $para :=73 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Notes Either operand (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)842 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)843. 8.4.5 op:divide-yearMonthDuration-by-yearMonthDurationSummaryReturns the ratio of two let $para :=24 values.Operator Mapping Defines the semantics of the "div" operator when applied to two let $para :=24 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)752( let $para :=70 let $para :=71 let $para :=24, let $para :=73 let $para :=71 let $para :=24) let $para :=71 let $para :=82Rules The function returns the result of dividing the length in months of let $para :=70 by the length in months of let $para :=73, according to the rules of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).99 function for integer operands. For handling of overflow and underflow, see 9.7.1 Limits and precision. NotesEither duration (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)858 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)859. The following example demonstrates how to calculate the length of an let $para :=24 value in months: The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)861 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)862. 8.4.6 op:add-dayTimeDurationsSummaryReturns the sum of two let $para :=25 values.Operator Mapping Defines the semantics of the "+" operator when applied to two let $para :=25 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)754( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=25) let $para :=71 let $para :=25Rules The function returns the result of adding the value of let $para :=70 to the value of let $para :=73. The result is the let $para :=25 whose length in seconds is equal to the sum of the length in seconds of the two input durations. For handling of overflow, see 9.7.1 Limits and precision. NotesEither duration (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)877 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)878. 8.4.7 op:subtract-dayTimeDurationsSummaryReturns the result of subtracting one let $para :=25 from another.Operator Mapping Defines the semantics of the "-" operator when applied to two let $para :=25 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)756( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=25) let $para :=71 let $para :=25Rules The function returns the result of subtracting the value of let $para :=73 from the value of let $para :=70. The result is the let $para :=25 whose length in seconds is equal to the length in seconds of let $para :=70 minus the length in seconds of let $para :=73. For handling of overflow, see 9.7.1 Limits and precision. NotesEither duration (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)895 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)896. 8.4.8 op:multiply-dayTimeDurationSummaryReturns the result of multiplying a let $para :=25 by a number.Operator Mapping Defines the semantics of the "*" operator when applied to an let $para :=25 and a numeric value.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)758( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=26) let $para :=71 let $para :=25Rules The function returns the result of multiplying the value of let $para :=70 by let $para :=73. The result is the let $para :=25 whose length in seconds is equal to the length in seconds of let $para :=70 multiplied by the numeric value let $para :=73. If let $para :=73 is positive or negative zero, the result is a zero-length duration. If let $para :=73 is positive or negative infinity, the result overflows and is handled as described in 9.1.1 Limits and precision. For handling of overflow and underflow, see 9.7.1 Limits and precision. Error ConditionsA dynamic error is raised [err:FOCA0005] if let $para :=73 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Notes Either operand (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)917 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)918. 8.4.9 op:divide-dayTimeDurationSummaryReturns the result of multiplying a let $para :=25 by a number.Operator Mapping Defines the semantics of the "div" operator when applied to two let $para :=25 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)760( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=26) let $para :=71 let $para :=25Rules The function returns the result of dividing the value of let $para :=70 by let $para :=73. The result is the let $para :=25 whose length in seconds is equal to the length in seconds of let $para :=70 divided by the numeric value let $para :=73. If let $para :=73 is positive or negative infinity, the result is a zero-length duration. If let $para :=73 is positive or negative zero, the result overflows and is handled as described in 9.1.1 Limits and precision. For handling of overflow and underflow, see 9.7.1 Limits and precision. Error ConditionsA dynamic error is raised [err:FOCA0005] if let $para :=73 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90.Notes Either operand (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)939 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)940. 8.4.10 op:divide-dayTimeDuration-by-dayTimeDurationSummaryReturns the ratio of two let $para :=25 values, as a decimal number.Operator Mapping Defines the semantics of the "div" operator when applied to two let $para :=25 values.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)762( let $para :=70 let $para :=71 let $para :=25, let $para :=73 let $para :=71 let $para :=25) let $para :=71 let $para :=82Rules The function returns the result of dividing the value of let $para :=70 by let $para :=73. The result is the let $para :=25 whose length in seconds is equal to the length in seconds of let $para :=70 divided by the length in seconds of let $para :=73. The calculation is performed by applying fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).99 to the two let $para :=82 operands. For handling of overflow and underflow, see 9.7.1 Limits and precision. NotesEither operand (and therefore the result) may be negative. ExamplesThe expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)959 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)960. This examples shows how to determine the number of seconds in a duration. The expression op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)961 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)962. 9 Functions and operators on dates and timesThis section defines operations on the [XML Schema Part 2: Datatypes Second Edition] date and time types. See [Working With Timezones] for a disquisition on working with date and time values with and without timezones. 9.1 Date and time typesThe operators described in this section are defined on the following date and time types:
The only operation defined on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970 values is equality comparison. For other types, further operations are provided, including component extraction, order comparisons, arithmetic, formatted display, and timezone adjustment. 9.1.1 Limits and precisionAll minimally conforming processors must support positive year values with a minimum of 4 digits (i.e., YYYY) and a minimum fractional second precision of 1 millisecond or three digits (i.e., s.sss). However, conforming processors may set larger ·implementation-defined· limits on the maximum number of digits they support in these two situations. Processors may also choose to support the year 0000 and years with negative values. The results of operations on dates that cross the year 0000 are ·implementation-defined·. A processor that limits the number of digits in date and time datatype representations may encounter overflow and underflow conditions when it tries to execute the functions in 9.7 Arithmetic operators on durations, dates and times. In these situations, the processor must return 00:00:00 in case of time underflow. It must raise a dynamic error [err:FODT0001] in case of overflow. 9.2 Date/time datatype valuesAs defined in Section 3.3.2 Dates and Times DM31, let $para :=29, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970 values, referred to collectively as date/time values, are represented as seven components or properties: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)985, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)986, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)987, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)988, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990. The first five components are let $para :=85 values. The value of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989 component is an let $para :=82 and the value of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990 component is an let $para :=25. For all the primitive date/time datatypes, the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990 property is optional and may or may not be present. Depending on the datatype, some of the remaining six properties must be present and some must be absentDM31. Absent, or missing, properties are represented by the empty sequence. This value is referred to as the local value in that the value retains its original timezone. Before comparing or subtracting let $para :=29 values, this local value must be translated or normalized to UTC. For op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 are alternate lexical forms for the same value, whose canonical representation is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999. For let $para :=29, a time component op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 translates to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 of the following day. 9.2.1 Examples
9.3 Constructing a dateTimeA function is provided for constructing a let $para :=29 value from a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 value and a op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value.FunctionMeaning op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)023Returns an let $para :=29 value created by combining an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965. 9.3.1 fn:dateTimeSummaryReturns an let $para :=29 value created by combining an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)023( let $para :=70 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033, let $para :=73 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf either let $para :=70 or let $para :=73 is the empty sequence the function returns the empty sequence. Otherwise, the function returns an let $para :=29 whose date component is equal to let $para :=70 and whose time component is equal to let $para :=73. The timezone of the result is computed as follows:
A dynamic error is raised [err:FORG0008] if the two arguments both have timezones and the timezones are different. ExamplesThe expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)044 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)045. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)046 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)047. (This is because op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)048 is an alternate lexical form for op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)049). 9.4 Comparison operators on duration, date and time valuesFunctionMeaningop:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050Returns true if the two supplied let $para :=29 values refer to the same instant in time. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)052Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first argument represents an earlier instant in time than the second argument. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)054Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first argument represents a later instant in time than the second argument. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)056Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the starting instants of the two supplied op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 values are the same. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)059Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the starting instant of let $para :=70 is less than the starting instant of let $para :=73. Returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 otherwise. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)064Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the starting instant of let $para :=70 is greater than the starting instant of let $para :=73. Returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 otherwise. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)069Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values represent the same instant in time, when treated as being times on the same date, before adjusting the timezone. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)072Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value represents an earlier instant in time than the second, when both are treated as being times on the same date, before adjusting the timezone. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)075Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value represents a later instant in time than the second, when both are treated as being times on the same date, before adjusting the timezone. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)078Returns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966 values have the same starting instant. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)080Returns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967 values have the same starting instant. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)082Returns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968 values have the same starting instant, when considered as days in the same year. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)084Returns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969 values have the same starting instant, when considered as months in the same year. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)086Returns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970 values have the same starting instant, when considered as days in the same month of the same year. The following comparison operators are defined on the [XML Schema Part 2: Datatypes Second Edition] date/time datatypes. Each operator takes two operands of the same type and returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 result. [XML Schema Part 2: Datatypes Second Edition] also states that the order relation on date and time datatypes is not a total order but a partial order because these datatypes may or may not have a timezone. This is handled as follows. If either operand to a comparison function on date or time values does not have an (explicit) timezone then, for the purpose of the operation, an implicit timezone, provided by the dynamic context Section C.2 Dynamic Context Components XP31, is assumed to be present as part of the value. This creates a total order for all date and time values. An let $para :=29 can be considered to consist of seven components: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)985, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)986, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)987, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)988, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990. For let $para :=29 six components ( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)985, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)986, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)987, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)988 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989) are required and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990 is optional. For other date/time values, of the first six components, some are required and others must be absentDM31. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)105 is always optional. For example, for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)985 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)986 components are required and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)987, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)988 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989 components must be absent; for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)987, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)988 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989 components are required and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)985 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)986 are missing; for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)986 is required and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)985, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)987, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)988 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)989 are missing. Note: In [Schema 1.1 Part 2], a new op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)127 facet is available with values op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)128, op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)129, or op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)130 to enable the timezone to be defined as mandatory or disallowed. Values of the date/time datatypes op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969, and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970, can be considered to represent a sequence of recurring time instants or time periods. An op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 occurs every day. An op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969 occurs every year. Comparison operators on these datatypes compare the starting instants of equivalent occurrences in the recurring series. These let $para :=29 values are calculated as described below. Comparison operators on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967 compare their starting instants. These let $para :=29 values are calculated as described below. The starting instant of an occurrence of a date/time value is an let $para :=29 calculated by filling in the missing components of the local value from a reference let $para :=29. An example of a suitable reference let $para :=29 is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)145. Then, for example, the starting instant corresponding to the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 value op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)147 is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)148; the starting instant corresponding to the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)150 is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)151; and the starting instant corresponding to the op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)152 value op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)153 is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)154 (which explains why a leap year was chosen for the reference). Note: In the previous version of this specification, the reference date/time chosen was op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)155. While this gives the same results, it produces a "starting instant" for a op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)156 or op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)152 that bears no relation to the ordinary meaning of the term, and it also required special handling of short months. The original choice was made to allow for leap seconds; but since leap seconds are not recognized in date/time arithmetic, this is not actually necessary. If the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value written as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 is to be compared, filling in the missing components gives op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)145, because op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 is an alternative representation of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 (the lexical value op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)048 is converted to the time components {0,0,0} before the missing components are filled in). This has the consequence that when ordering op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values, op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 is considered to be earlier than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)166. However, when ordering let $para :=29 values, a time component of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 is considered equivalent to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 on the following day. Note that the reference let $para :=29 does not have a timezone. The op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990 component is never filled in from the reference let $para :=29. In some cases, if the date/time value does not have a timezone, the implicit timezone from the dynamic context is used as the timezone. Note: This specification uses the reference op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)173 in the description of the comparison operators. Implementations may use other reference let $para :=29 values as long as they yield the same results. The reference let $para :=29 used must meet the following constraints: when it is used to supply components into op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968 values, the year must allow for February 29 and so must be a leap year; when it is used to supply missing components into op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970 values, the month must allow for 31 days. Different reference let $para :=29 values may be used for different operators. 9.4.1 op:dateTime-equalSummaryReturns true if the two supplied let $para :=29 values refer to the same instant in time.Operator Mapping Defines the semantics of the "eq" operator when applied to two let $para :=29 values. Also used in the definition of the "ne", "le" and "ge" operators.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=29) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesIf either let $para :=70 or let $para :=73 has no timezone component, the effective value of the argument is obtained by substituting the implicit timezone from the dynamic evaluation context. The function then returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the effective value of let $para :=70 is equal to the effective value of let $para :=73 according to the algorithm defined in section 3.2.7.4 of [XML Schema Part 2: Datatypes Second Edition] "Order relation on dateTime" for let $para :=29 values with timezones. Otherwise the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197 The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)198 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)200 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)202 returns let $para :=184. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)204 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)206 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)208 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)210 returns let $para :=184. 9.4.2 op:dateTime-less-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first argument represents an earlier instant in time than the second argument.Operator Mapping Defines the semantics of the "lt" operator when applied to two let $para :=29 values. Also used in the definition of the "ge" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)052( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=29) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesIf either let $para :=70 or let $para :=73 has no timezone component, the effective value of the argument is obtained by substituting the implicit timezone from the dynamic evaluation context. The function then returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the effective value of let $para :=70 is less than the effective value of let $para :=73 according to the algorithm defined in section 3.2.7.4 of [XML Schema Part 2: Datatypes Second Edition] "Order relation on dateTime" for let $para :=29 values with timezones. Otherwise the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 9.4.3 op:dateTime-greater-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first argument represents a later instant in time than the second argument.Operator Mapping Defines the semantics of the "gt" operator when applied to two let $para :=29 values. Also used in the definition of the "le" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)054( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=29) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe function call op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)241 is defined to return the same result as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)242 9.4.4 op:date-equalSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the starting instants of the two supplied op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 values are the same.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 values. Also used in the definition of the "ne", "le" and "ge" operators.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)056( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe starting instant of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 is the let $para :=29 at time op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 on that date. The function returns the result of the expression: let $para :=2Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)258 returns let $para :=184. (The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)260 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)261. These are normalized to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)260 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)263. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)264 returns let $para :=182. 9.4.5 op:date-less-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the starting instant of let $para :=70 is less than the starting instant of let $para :=73. Returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 otherwise.Operator Mapping Defines the semantics of the "lt" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 values. Also used in the definition of the "ge" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)059( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The starting instant of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 is the let $para :=29 at time op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 on that date. The function returns the result of the expression: let $para :=3Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)283 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)285 returns let $para :=184. 9.4.6 op:date-greater-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if the starting instant of let $para :=70 is greater than the starting instant of let $para :=73. Returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 otherwise.Operator Mapping Defines the semantics of the "gt" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 values. Also used in the definition of the "le" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)064( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe function call op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)301 is defined to return the same result as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)302Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)303 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)305 returns let $para :=184. 9.4.7 op:time-equalSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values represent the same instant in time, when treated as being times on the same date, before adjusting the timezone.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values. Also used in the definition of the "ne", "le" and "ge" operators.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)069( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesEach of the supplied op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values is expanded to an let $para :=29 value by associating the time with an arbitrary date. The function returns the result of comparing these two let $para :=29 values using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050. The result of the function is thus the same as the value of the expression: let $para :=4Examples Assume that the date components from the reference let $para :=29 correspond to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)324. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)325 returns let $para :=184. (The let $para :=29s calculated using the reference date components are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)328 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)329. These normalize to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)330 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)331. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)332 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)334 returns let $para :=182. (This not the result one might expect. For let $para :=29 values, a time of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 is equivalent to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 on the following day. For op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, the normalization from op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 happens before the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 is converted into an let $para :=29 for the purpose of the equality comparison. For op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, any operation on op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 produces the same result as the same operation on op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 because these are two different lexical representations of the same value. ). 9.4.8 op:time-less-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value represents an earlier instant in time than the second, when both are treated as being times on the same date, before adjusting the timezone.Operator Mapping Defines the semantics of the "lt" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values. Also used in the definition of the "ge" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)072( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesEach of the supplied op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values is expanded to an let $para :=29 value by associating the time with an arbitrary date. The function returns the result of comparing these two let $para :=29 values using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)052. The result of the function is thus the same as the value of the expression: let $para :=5Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)364 returns let $para :=184. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)366 returns let $para :=182. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)368 returns let $para :=184. 9.4.9 op:time-greater-thanSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the first op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value represents a later instant in time than the second, when both are treated as being times on the same date, before adjusting the timezone.Operator Mapping Defines the semantics of the "gt" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values. Also used in the definition of the "le" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)075( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe function call op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)382 is defined to return the same result as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)383Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)384 returns let $para :=184. 9.4.10 op:gYearMonth-equalSummaryReturns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966 values have the same starting instant.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966 values. Also used in the definition of the "ne" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)078( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe starting instants of let $para :=70 and let $para :=73 are calculated by supplying the missing components of let $para :=70 and let $para :=73 from the let $para :=29 template op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)402. The function returns the result of comparing these two starting instants using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)405 returns let $para :=184. The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)407 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)408, respectively. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)409 returns let $para :=184. The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)411 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)412, respectively. 9.4.11 op:gYear-equalSummaryReturns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967 values have the same starting instant.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967 values. Also used in the definition of the "ne" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)080( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe starting instants of let $para :=70 and let $para :=73 are calculated by supplying the missing components of let $para :=70 and let $para :=73 from the let $para :=29 template op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)429. The function returns the result of comparing these two starting instants using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. Assume, also, that the let $para :=29 template is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)429. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)434 returns let $para :=184. The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)436 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)437, respectively, and normalize to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)438 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)439. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)440 returns let $para :=182. 9.4.12 op:gMonthDay-equalSummaryReturns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968 values have the same starting instant, when considered as days in the same year.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968 values. Also used in the definition of the "ne" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)082( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)968) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe starting instants of let $para :=70 and let $para :=73 are calculated by supplying the missing components of let $para :=70 and let $para :=73 from the let $para :=29 template op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)458 or an equivalent. The function returns the result of comparing these two starting instants using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. Assume for the purposes of illustration that the let $para :=29 template used is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)458 (this does not affect the result). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)463 returns let $para :=182. ( The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)465 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)466, respectively, and normalize to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)467 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)467. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)469 returns let $para :=184. 9.4.13 op:gMonth-equalSummaryReturns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969 values have the same starting instant, when considered as months in the same year.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969 values. Also used in the definition of the "ne" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)084( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)969) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe starting instants of let $para :=70 and let $para :=73 are calculated by supplying the missing components of let $para :=70 and let $para :=73 from the let $para :=29 template op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)487 or an equivalent. The function returns the result of comparing these two starting instants using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. Assume, also, that the let $para :=29 template chosen is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)487. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)492 returns let $para :=184. ( The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)494 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)495, respectively, and normalize to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)496 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)497. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)498 returns let $para :=184. 9.4.14 op:gDay-equalSummaryReturns true if the two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970 values have the same starting instant, when considered as days in the same month of the same year.Operator Mapping Defines the semantics of the "eq" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970 values. Also used in the definition of the "ne" operator.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)086( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)970) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe starting instants of let $para :=70 and let $para :=73 are calculated by supplying the missing components of let $para :=70 and let $para :=73 from the let $para :=29 template op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)516 or an equivalent. The function returns the result of comparing these two starting instants using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)050.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. Assume, also, that the let $para :=29 template is op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)516. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)521 returns let $para :=184. ( The starting instants are op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)465 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)524, respectively, and normalize to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)467 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)526. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)527 returns let $para :=184. 9.5 Component extraction functions on dates and timesThe date and time datatypes may be considered to be composite datatypes in that they contain distinct properties or components. The extraction functions specified below extract a single component from a date or time value. In all cases the local value (that is, the original value as written, without any timezone adjustment) is used. Note: A time written as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)000 is treated as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 on the following day.FunctionMeaning op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)531Returns the year component of an let $para :=29. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)533Returns the month component of an let $para :=29. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)535Returns the day component of an let $para :=29. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)537Returns the hours component of an let $para :=29. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)539Returns the minute component of an let $para :=29. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)541Returns the seconds component of an let $para :=29. let $para :=89Returns the timezone component of an let $para :=29. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)545Returns the year component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)547Returns the month component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)549Returns the day component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)551Returns the timezone component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)553Returns the hours component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)555Returns the minutes component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)557Returns the seconds component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)559Returns the timezone component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965. 9.5.1 fn:year-from-dateTimeSummaryReturns the year component of an let $para :=29.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)531( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the year component in the local value of let $para :=25. The result may be negative.Notes Ignoring complications that arise with midnight on the last day of the year, the year returned is the same numeric value that appears in the lexical representation, which for negative years means the meaning may vary depending on whether XSD 1.0 or XSD 1.1 conventions are in use. ExamplesThe expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)571 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)572. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)573 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)572. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)575 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)572. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)577 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)578. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)579 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)580. (The result is the same whether XSD 1.0 or 1.1 is in use, despite the absence of a year 0 in the XSD 1.0 value space.) 9.5.2 fn:month-from-dateTimeSummaryReturns the month component of an let $para :=29.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)533( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 between 1 and 12, both inclusive, representing the month component in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)591 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)593 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)700. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)595 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 9.5.3 fn:day-from-dateTimeSummaryReturns the day component of an let $para :=29.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)535( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 between 1 and 31, both inclusive, representing the day component in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)607 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)608. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)609 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)608. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)611 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 9.5.4 fn:hours-from-dateTimeSummaryReturns the hours component of an let $para :=29.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)537( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 between 0 and 23, both inclusive, representing the hours component in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)623 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)624. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)625 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)638. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)627 returns let $para :=226. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)629 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)700. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)631 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 9.5.5 fn:minutes-from-dateTimeSummaryReturns the minute component of an let $para :=29.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)539( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 value between 0 and 59, both inclusive, representing the minute component in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)643 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)644. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)645 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)646. 9.5.6 fn:seconds-from-dateTimeSummaryReturns the seconds component of an let $para :=29.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)541( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)728Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=82 value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)657 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 9.5.7 fn:timezone-from-dateTimeSummaryReturns the timezone component of an let $para :=29.Signature let $para :=89( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)665Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns the timezone component of let $para :=25, if any. If let $para :=25 has a timezone component, then the result is an let $para :=25 that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If let $para :=25 has no timezone component, the result is the empty sequence.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)671 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)672. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)673 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)674. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)675 returns let $para :=96. 9.5.8 fn:year-from-dateSummaryReturns the year component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)545( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 representing the year in the local value of let $para :=25. The value may be negative.Notes The year returned is the same numeric value that appears in the lexical representation, which for negative years means the meaning may vary depending on whether XSD 1.0 or XSD 1.1 conventions are in use. ExamplesThe expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)687 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)572. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)689 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)578. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)691 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)580. (The result is the same whether XSD 1.0 or 1.1 is in use, despite the absence of a year 0 in the XSD 1.0 value space.) 9.5.9 fn:month-from-dateSummaryReturns the month component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)547( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 between 1 and 12, both inclusive, representing the month component in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)703 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)705 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 9.5.10 fn:day-from-dateSummaryReturns the day component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)549( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 between 1 and 31, both inclusive, representing the day component in the localized value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)717 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)608. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)719 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 9.5.11 fn:timezone-from-dateSummaryReturns the timezone component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)551( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)665Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns the timezone component of let $para :=25, if any. If let $para :=25 has a timezone component, then the result is an let $para :=25 that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If let $para :=25 has no timezone component, the result is the empty sequence.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)733 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)672. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)735 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)674. 9.5.12 fn:hours-from-timeSummaryReturns the hours component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)553( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 between 0 and 23, both inclusive, representing the value of the hours component in the local value of let $para :=25.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)748 returns let $para :=032. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)750 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)638. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)752 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)754 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)644. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)756 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 9.5.13 fn:minutes-from-timeSummaryReturns the minutes component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)555( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036) let $para :=71 let $para :=229Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=85 value between 0 and 59, both inclusive, representing the value of the minutes component in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)768 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. 9.5.14 fn:seconds-from-timeSummaryReturns the seconds component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)557( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)728Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns an let $para :=82 value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the local value of let $para :=25.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)780 returns let $para :=010. 9.5.15 fn:timezone-from-timeSummaryReturns the timezone component of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)559( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)665Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. Otherwise, the function returns the timezone component of let $para :=25, if any. If let $para :=25 has a timezone component, then the result is an let $para :=25 that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. If let $para :=25 has no timezone component, the result is the empty sequence.Examples The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)794 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)672. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)796 returns let $para :=96. 9.6 Timezone adjustment functions on dates and time valuesFunctionMeaninglet $para :=86Adjusts an let $para :=29 value to a specific timezone, or to no timezone at all. let $para :=85Adjusts an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 value to a specific timezone, or to no timezone at all; the result is the date in the target timezone that contains the starting instant of the supplied date. let $para :=87Adjusts an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value to a specific timezone, or to no timezone at all. These functions adjust the timezone component of an let $para :=29, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 or op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value. The op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 argument to these functions is defined as an let $para :=25 but must be a valid timezone value. 9.6.1 fn:adjust-dateTime-to-timezoneSummaryAdjusts an let $para :=29 value to a specific timezone, or to no timezone at all.Signatures let $para :=86( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038 let $para :=86( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038, op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)665) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not specified, then the effective value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the value of the implicit timezone in the dynamic context. If let $para :=25 is the empty sequence, then the function returns the empty sequence. If let $para :=25 does not have a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the empty sequence, then the result is let $para :=25. If let $para :=25 does not have a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not the empty sequence, then the result is let $para :=25 with op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 as the timezone component. If let $para :=25 has a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the empty sequence, then the result is the local value of let $para :=25 without its timezone component. If let $para :=25 has a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not the empty sequence, then the result is the let $para :=29 value that is equal to let $para :=25 and that has a timezone component equal to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807.Error Conditions A dynamic error is raised [err:FODT0003] if op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is less than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)844 or greater than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)845 or is not an integral number of minutes.Examples Assume the dynamic context provides an implicit timezone of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)846. let $para :=6 The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)847 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)848. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)849 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)850. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)851 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)852. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)853 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)854. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)855 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)856. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)857 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)858. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)859 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)860. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)861 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)860. 9.6.2 fn:adjust-date-to-timezoneSummaryAdjusts an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 value to a specific timezone, or to no timezone at all; the result is the date in the target timezone that contains the starting instant of the supplied date.Signatures let $para :=85( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033 let $para :=85( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033, op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)665) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not specified, then the effective value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the value of the implicit timezone in the dynamic context. If let $para :=25 is the empty sequence, then the function returns the empty sequence. If let $para :=25 does not have a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the empty sequence, then the result is the value of let $para :=25. If let $para :=25 does not have a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not the empty sequence, then the result is let $para :=25 with op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 as the timezone component. If let $para :=25 has a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the empty sequence, then the result is the local value of let $para :=25 without its timezone component. If let $para :=25 has a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not the empty sequence, then the function returns the value of the expression:
A dynamic error is raised [err:FODT0003] if op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is less than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)844 or greater than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)845 or is not an integral number of minutes.Examples Assume the dynamic context provides an implicit timezone of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)846. let $para :=6 The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)903 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)904. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)905 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)904. ( let $para :=25 is converted to op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)908. This is adjusted to the implicit timezone, giving op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)909. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)910 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)911. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)912 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)913. ( let $para :=25 is converted to the op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)915. This is adjusted to the given timezone, giving op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)916. ). The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)917 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)918. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)919 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)918. 9.6.3 fn:adjust-time-to-timezoneSummaryAdjusts an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value to a specific timezone, or to no timezone at all.Signatures let $para :=87( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036 let $para :=87( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036, op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)665) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not specified, then the effective value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the value of the implicit timezone in the dynamic context. If let $para :=25 is the empty sequence, then the function returns the empty sequence. If let $para :=25 does not have a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the empty sequence, then the result is let $para :=25. If let $para :=25 does not have a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not the empty sequence, then the result is let $para :=25 with op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 as the timezone component. If let $para :=25 has a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is the empty sequence, then the result is the localized value of let $para :=25 without its timezone component. If let $para :=25 has a timezone component and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is not the empty sequence, then:
A dynamic error is raised [err:FODT0003] if op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)807 is less than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)844 or greater than op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)845 or if does not contain an integral number of minutes.Examples Assume the dynamic context provides an implicit timezone of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)846. let $para :=6 The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)963 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)964. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)965 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)966. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)967 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)968. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)969 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)970. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)971 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)972. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)973 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)972. The expression op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)975 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)976. 9.7 Arithmetic operators on durations, dates and timesThese functions support adding or subtracting a duration value to or from an let $para :=29, an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 or an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value. Appendix E of [XML Schema Part 2: Datatypes Second Edition] describes an algorithm for performing such operations.FunctionMeaning op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)980Returns an let $para :=25 representing the amount of elapsed time between the instants op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)982 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)983. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)984Returns the let $para :=25 that corresponds to the elapsed time between the starting instant of let $para :=73 and the starting instant of let $para :=73. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)988Returns the let $para :=25 that corresponds to the elapsed time between the values of let $para :=73 and let $para :=70 treated as times on the same date. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)992Returns the let $para :=29 that is a given duration after a specified let $para :=29 (or before, if the duration is negative). op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)995Returns the let $para :=29 that is a given duration after a specified let $para :=29 (or before, if the duration is negative). op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)998Returns the let $para :=29 that is a given duration before a specified let $para :=29 (or after, if the duration is negative). fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).001Returns the let $para :=29 that is a given duration before a specified let $para :=29 (or after, if the duration is negative). fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).004Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration after a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or before, if the duration is negative). fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).007Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration after a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or before, if the duration is negative). fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).010Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration before a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or after, if the duration is negative). fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).013Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration before a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or after, if the duration is negative). fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).016Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value that is a given duration after a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 (or before, if the duration is negative or causes wrap-around past midnight) fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).019Returns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value that is a given duration before a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 (or after, if the duration is negative or causes wrap-around past midnight) 9.7.1 Limits and precisionA processor that limits the number of digits in date and time datatype representations may encounter overflow and underflow conditions when it tries to execute the functions in this section. In these situations, the processor must return P0M or PT0S in case of duration underflow and 00:00:00 in case of time underflow. It must raise a dynamic error [err:FODT0001] in case of overflow. The value spaces of the two totally ordered subtypes of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 described in 8.1 Two totally ordered subtypes of duration are let $para :=85 months for let $para :=24 and let $para :=82 seconds for let $para :=25. If a processor limits the number of digits allowed in the representation of let $para :=85 and let $para :=82 then overflow and underflow situations can arise when it tries to execute the functions in 8.4 Arithmetic operators on durations. In these situations the processor must return zero in case of numeric underflow and P0M or PT0S in case of duration underflow. It must raise a dynamic error [err:FODT0002] in case of overflow. 9.7.2 op:subtract-dateTimesSummaryReturns an let $para :=25 representing the amount of elapsed time between the instants op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)982 and op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)983.Operator Mapping Defines the semantics of the "-" operator when applied to two let $para :=29 values.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)980( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=29) let $para :=71 let $para :=25Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesIf either let $para :=70 or let $para :=73 do not contain an explicit timezone then, for the purpose of the operation, the implicit timezone provided by the dynamic context (See Section C.2 Dynamic Context Components XP31.) is assumed to be present as part of the value. The function returns the elapsed time between the date/time instant op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)982 and the date/time instant op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)983, computed according to the algorithm given in Appendix E of [XML Schema Part 2: Datatypes Second Edition], and expressed as a let $para :=25. If the normalized value of let $para :=70 precedes in time the normalized value of let $para :=73, then the returned value is a negative duration.Examples Assume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).050 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).051. 9.7.3 op:subtract-datesSummaryReturns the let $para :=25 that corresponds to the elapsed time between the starting instant of let $para :=73 and the starting instant of let $para :=73.Operator Mapping Defines the semantics of the "-" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 values.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)984( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964) let $para :=71 let $para :=25Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesIf either let $para :=70 or let $para :=73 do not contain an explicit timezone then, for the purpose of the operation, the implicit timezone provided by the dynamic context (See Section C.2 Dynamic Context Components XP31.) is assumed to be present as part of the value. The starting instant of an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 is the let $para :=29 at op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)999 on that date. The function returns the result of subtracting the two starting instants using op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)980. If the starting instant of let $para :=70 precedes in time the starting instant of let $para :=73, then the returned value is a negative duration.Examples Assume that the dynamic context provides an implicit timezone value of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).073. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).074 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).075. (The normalized values of the two starting instants are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).076 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).077.) Now assume that the dynamic context provides an implicit timezone value of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).078. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).079 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).080. ( The normalized values of the two starting instants are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).081 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).077.) The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).083 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).084. 9.7.4 op:subtract-timesSummaryReturns the let $para :=25 that corresponds to the elapsed time between the values of let $para :=73 and let $para :=70 treated as times on the same date.Operator Mapping Defines the semantics of the "-" operator when applied to two op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)988( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, let $para :=73 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965) let $para :=71 let $para :=25Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesThe function returns the result of the expression: let $para :=9Notes Any other reference date would work equally well. ExamplesAssume that the dynamic context provides an implicit timezone value of op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)197. Assume, also, that the date components of the reference let $para :=29 correspond to fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).100. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).101 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).102. (This is obtained by subtracting from the let $para :=29 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).104 the let $para :=29 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).106.) The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).107 returns op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)674. (The two let $para :=29 values are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).110 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).111. These normalize to fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).112 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).112. ). The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).114 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).115. (The two normalized let $para :=29 values are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).117 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).118.) The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).119 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).120. (The two normalized let $para :=29 values are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).122 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).123.) 9.7.5 op:add-yearMonthDuration-to-dateTimeSummaryReturns the let $para :=29 that is a given duration after a specified let $para :=29 (or before, if the duration is negative).Operator Mapping Defines the semantics of the "+" operator when applied to an let $para :=29 and an let $para :=24 value.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)992( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=24) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the result of adding let $para :=73 to the value of let $para :=70 using the algorithm described in Appendix E of [XML Schema Part 2: Datatypes Second Edition], disregarding the rule about leap seconds. If let $para :=73 is negative, then the result let $para :=29 precedes let $para :=70. The result has the same timezone as let $para :=70. If let $para :=70 has no timezone, the result has no timezone.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).144 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).145. 9.7.6 op:add-dayTimeDuration-to-dateTimeSummaryReturns the let $para :=29 that is a given duration after a specified let $para :=29 (or before, if the duration is negative).Operator Mapping Defines the semantics of the "+" operator when applied to an let $para :=29 and an let $para :=25 value.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)995( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=25) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the result of adding let $para :=73 to the value of let $para :=70 using the algorithm described in Appendix E of [XML Schema Part 2: Datatypes Second Edition], disregarding the rule about leap seconds. If let $para :=73 is negative, then the result let $para :=29 precedes let $para :=70. The result has the same timezone as let $para :=70. If let $para :=70 has no timezone, the result has no timezone.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).166 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).167. 9.7.7 op:subtract-yearMonthDuration-from-dateTimeSummaryReturns the let $para :=29 that is a given duration before a specified let $para :=29 (or after, if the duration is negative).Operator Mapping Defines the semantics of the "-" operator when applied to an let $para :=29 and an let $para :=24 value.Signature op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)998( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=24) let $para :=71 let $para :=29Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the let $para :=29 computed by negating let $para :=73 and adding the result to the value of let $para :=70 using the function op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)992.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).185 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).186. 9.7.8 op:subtract-dayTimeDuration-from-dateTimeSummaryReturns the let $para :=29 that is a given duration before a specified let $para :=29 (or after, if the duration is negative).Operator Mapping Defines the semantics of the "-" operator when applied to an let $para :=29 an and let $para :=25 valuesSignature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).001( let $para :=70 let $para :=71 let $para :=29, let $para :=73 let $para :=71 let $para :=25) let $para :=71 let $para :=29Rules The function returns the let $para :=29 computed by negating let $para :=73 and adding the result to the value of let $para :=70 using the function op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)995.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).204 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).205. 9.7.9 op:add-yearMonthDuration-to-dateSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration after a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or before, if the duration is negative).Operator Mapping Defines the semantics of the "+" operator when applied to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and an let $para :=24 value.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).004( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 let $para :=24) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the result of casting let $para :=70 to an let $para :=29, adding let $para :=73 using the function op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)992, and casting the result back to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).224 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).225. 9.7.10 op:add-dayTimeDuration-to-dateSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration after a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or before, if the duration is negative).Operator Mapping Defines the semantics of the "+" operator when applied to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and an let $para :=25 value.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).007( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 let $para :=25) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the result of casting let $para :=70 to an let $para :=29, adding let $para :=73 using the function op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)995, and casting the result back to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).244 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).245. ( The starting instant of the first argument is the let $para :=29 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).247. Adding the second argument to this gives the let $para :=29 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).249. The time components are then discarded. ). 9.7.11 op:subtract-yearMonthDuration-from-dateSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration before a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or after, if the duration is negative).Operator Mapping Defines the semantics of the "-" operator when applied to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and an let $para :=24 value.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).010( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 let $para :=24) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 computed by negating let $para :=73 and adding the result to let $para :=70 using the function fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).004.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).267 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).268. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).269 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).270. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).271 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).272. 9.7.12 op:subtract-dayTimeDuration-from-dateSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 that is a given duration before a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (or after, if the duration is negative).Operator Mapping Defines the semantics of the "-" operator when applied to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and an let $para :=25. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).013( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=73 let $para :=71 let $para :=25) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 computed by negating let $para :=73 and adding the result to let $para :=70 using the function fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).007.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).290 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).291. 9.7.13 op:add-dayTimeDuration-to-timeSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value that is a given duration after a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 (or before, if the duration is negative or causes wrap-around past midnight)Operator Mapping Defines the semantics of the "+" operator when applied to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 and an let $para :=25 value.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).016( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, let $para :=73 let $para :=71 let $para :=25) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965Rules First, the days component in the canonical lexical representation of let $para :=73 is set to zero (0) and the value of the resulting let $para :=25 is calculated. Alternatively, the value of let $para :=73 modulus 86,400 is used as the second argument. This value is added to the value of let $para :=70 converted to an let $para :=29 using a reference date such as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)324, and the time component of the result is returned. Note that the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 returned may occur in a following or preceding day and may be less than let $para :=70. The result has the same timezone as let $para :=70. If let $para :=70 has no timezone, the result has no timezone.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).315 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).316. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).317 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).318. (That is, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).319). 9.7.14 op:subtract-dayTimeDuration-from-timeSummaryReturns the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value that is a given duration before a specified op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 (or after, if the duration is negative or causes wrap-around past midnight)Operator Mapping Defines the semantics of the "-" operator when applied to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 and an let $para :=25 value.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).019( let $para :=70 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965, let $para :=73 let $para :=71 let $para :=25) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the result of negating let $para :=73 and adding the result to let $para :=70 using the function fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).016.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).336 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).337. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).338 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).339. 9.8 Formatting dates and timesFunctionMeaningfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).340Returns a string containing an let $para :=29 value formatted for display. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).342Returns a string containing an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 value formatted for display. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).344Returns a string containing an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value formatted for display. Three functions are provided to represent dates and times as a string, using the conventions of a selected calendar, language, and country. The signatures are presented first, followed by the rules which apply to each of the functions. 9.8.1 fn:format-dateTimeSummaryReturns a string containing an let $para :=29 value formatted for display.Signatures fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).340( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038, let $para :=230 let $para :=71 let $para :=10) let $para :=71 let $para :=244 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).340( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038, let $para :=230 let $para :=71 let $para :=10, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 let $para :=71 let $para :=244) let $para :=71 let $para :=244Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on default calendar, and default language, and default place, and implicit timezone. The five-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone, and namespaces. RulesSee 9.8.4 The date/time formatting functions. 9.8.2 fn:format-dateSummaryReturns a string containing an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 value formatted for display.Signatures fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).342( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033, let $para :=230 let $para :=71 let $para :=10) let $para :=71 let $para :=244 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).342( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033, let $para :=230 let $para :=71 let $para :=10, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 let $para :=71 let $para :=244) let $para :=71 let $para :=244Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on default calendar, and default language, and default place, and implicit timezone. The five-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone, and namespaces. RulesSee 9.8.4 The date/time formatting functions. 9.8.3 fn:format-timeSummaryReturns a string containing an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value formatted for display.Signatures fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).344( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036, let $para :=230 let $para :=71 let $para :=10) let $para :=71 let $para :=244 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).344( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)036, let $para :=230 let $para :=71 let $para :=10, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 let $para :=71 let $para :=244) let $para :=71 let $para :=244Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on default calendar, and default language, and default place, and implicit timezone. The five-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone, and namespaces. RulesSee 9.8.4 The date/time formatting functions. 9.8.4 The date/time formatting functionsThe fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).340, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).342, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).344 functions format fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 as a string using the picture string specified by the let $para :=230 argument, the calendar specified by the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366 argument, the language specified by the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 argument, and the country or other place name specified by the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument. The result of the function is the formatted string representation of the supplied let $para :=29, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, or op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 value. [Definition] The three functions If fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 is the empty sequence, the function returns the empty sequence. Calling the two-argument form of each of the three functions is equivalent to calling the five-argument form with each of the last three arguments set to an empty sequence. For details of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 arguments, see 9.8.4.8 The language, calendar, and place arguments. In general, the use of an invalid let $para :=230, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument results in a dynamic error [err:FOFD1340]. By contrast, use of an option in any of these arguments that is valid but not supported by the implementation is not an error, and in these cases the implementation is required to output the value in a fallback representation. More detailed rules are given below. 9.8.4.1 The picture stringThe picture consists of a sequence of variable markers and literal substrings. A substring enclosed in square brackets is interpreted as a variable marker; substrings not enclosed in square brackets are taken as literal substrings. The literal substrings are optional and if present are rendered unchanged, including any whitespace. If an opening or closing square bracket is required within a literal substring, it must be doubled. The variable markers are replaced in the result by strings representing aspects of the date and/or time to be formatted. These are described in detail below. A variable marker consists of a component specifier followed optionally by one or two presentation modifiers and/or optionally by a width modifier. Whitespace within a variable marker is ignored. The variable marker may be separated into its components by applying the following rules:
The component specifier indicates the component of the date or time that is required, and takes the following values: SpecifierMeaningDefault Presentation ModifierYyear (absolute value)1Mmonth in year1Dday in month1dday in year1Fday of weeknWweek in year1wweek in month1Hhour in day (24 hours)1hhour in half-day (12 hours)1Pam/pm markernmminute in hour01ssecond in minute01ffractional seconds1Ztimezone01:01ztimezone (same as Z, but modified where appropriate to include a prefix as a time offset using GMT, for example GMT+1 or GMT-05:00. For this component there is a fixed prefix offn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).452, or a localized variation thereof for the chosen language, and the remainder of the value is formatted as for specifier fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).073.01:01Ccalendar: the name or abbreviation of a calendar namenEera: the name of a baseline for the numbering of years, for example the reign of a monarchn A dynamic error is reported [err:FOFD1340] if the syntax of the picture is incorrect. A dynamic error is reported [err:FOFD1350] if a component specifier within the picture refers to components that are not available in the given type of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44, for example if the picture supplied to the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).344 refers to the year, month, or day component. It is not an error to include a timezone component when the supplied value has no timezone. In these circumstances the timezone component will be ignored. The first presentation modifier indicates the style in which the value of a component is to be represented. Its value may be either:
If a comma is to be used as a grouping separator within the format token, then there must be a width specifier. More specifically: if a variable marker contains one or more commas, then the last comma is treated as introducing the width modifier, and all others are treated as grouping separators. So fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).467 will output the year as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).468. It is not possible to use a closing square bracket as a grouping separator within the format token. If the implementation does not support the use of the requested format token, it must use the default presentation modifier for that component. If the first presentation modifier is present, then it may optionally be followed by a second presentation modifier as follows: ModifierMeaningeitherdeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);39 or let $para :=303indicates alphabetic or traditional numbering respectively, the default being ·implementation-defined·. This has the same meaning as in the second argument of let $para :=225.either let $para :=300 or let $para :=292indicates cardinal or ordinal numbering respectively, for example fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).474 or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).475 for a cardinal number, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).476, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).477, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).478 for an ordinal number. This has the same meaning as in the second argument of let $para :=225. The actual representation of the ordinal form of a number may depend not only on the language, but also on the grammatical context (for example, in some languages it must agree in gender). Note: Although the formatting rules are expressed in terms of the rules for format tokens in let $para :=225, the formats actually used may be specialized to the numbering of date components where appropriate. For example, in Italian, it is conventional to use an ordinal number ( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).481) for the first day of the month, and cardinal numbers ( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).482) for the remaining days. A processor may therefore use this convention to number days of the month, ignoring the presence or absence of the ordinal presentation modifier. 9.8.4.2 The Width ModifierWhether or not a presentation modifier is included, a width modifier may be supplied. This indicates the number of characters to be included in the representation of the value. The width modifier, if present, is introduced by a comma. It takes the form: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).483 where fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).484 is either an unsigned integer indicating the minimum number of characters to be output, or let $para :=68 indicating that there is no explicit minimum, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).486 is either an unsigned integer indicating the maximum number of characters to be output, or let $para :=68 indicating that there is no explicit maximum; if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).486 is omitted then let $para :=68 is assumed. A dynamic error ([err:FOFD1340]) is raised if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).484 is present and less than one, or if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).486 is present and less than one or less than fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).484. A format token containing more than one digit, such as let $para :=254 or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).494, sets the minimum and maximum width to the number of digits appearing in the format token; if a width modifier is also present, then the width modifier takes precedence. 9.8.4.3 Formatting Integer-Valued Date/Time ComponentsThe rules in this section apply to the majority of integer-valued components: specifically fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).495. In the rules below, the term decimal digit pattern has the meaning given in 4.6.1 fn:format-integer.
9.8.4.4 Formatting the Year ComponentThe rules for the year component (Y) are the same as those in 9.8.4.3 Formatting Integer-Valued Date/Time Components, except that the value of the year as output is the value of the year component of the supplied value modulo ten to the power N where N is determined as follows:
9.8.4.5 Formatting Fractional SecondsThe output for the fractional seconds component ( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).501) is equivalent to the result of the following algorithm:
Note: The reason for presenting the algorithm in this way is that it enables maximum re-use of the rules defined for let $para :=225. Since the fractional seconds value is not properly an integer, the rules do not work if used directly: for example, the positions of grouping separators need to be counted from the left rather than from the right. Implementations, as always, are free to use a different algorithm that yields the same result. Note: A format token consisting of a single digit, such as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13, does not constrain the number of digits in the output. In the case of fractional seconds in particular, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).512 requests three decimal digits, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).513 requests two digits, but fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).514 will retain all digits in the supplied date/time value (the maximum number of digits is implementation-defined). If exactly one digit is required, this can be achieved using the component specifier fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).515. 9.8.4.6 Formatting timezonesSpecial rules apply to the formatting of timezones. When the component specifiers fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).073 or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).517 are used, the rules in this section override any rules given elsewhere in the case of discrepancies. If the date/time value to be formatted does not include a timezone offset, then the timezone component specifier is generally ignored (results in no output). The exception is where military timezones are used (format ZZ) in which case the string "J" is output, indicating local time.
The following examples illustrate options for timezone formatting. Variable markerfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369Timezone offsets (with time = 12:00:00) -10:00-05:00+00:00+05:30+13:00[Z]()-10:00-05:00+00:00+05:30+13:00[Z0]()-10-5+0+5:30+13[Z0:00]()-10:00-5:00+0:00+5:30+13:00[Z00:00]()-10:00-05:00+00:00+05:30+13:00[Z0000]()-1000-0500+0000+0530+1300[Z00:00t]()-10:00-05:00Z+05:30+13:00[z]()GMT‑10:00GMT‑05:00GMT+00:00GMT+05:30GMT+13:00[ZZ]()WRZ+05:30+13:00[ZN]"us"HSTESTGMTIST+13:00[H00]:[M00] [ZN]"America/New_York"06:00 EST12:00 EST07:00 EST01:30 EST18:00 EST If a width specifier is present when formatting a timezone, then the representation as defined in this section is padded to the minimum width as described in 9.8.4.2 The Width Modifier, but it is never shortened. 9.8.4.7 Formatting Other ComponentsThis section applies to the remaining components: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).545 (am/pm marker), fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).546 (calendar), and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).547 (era). The output for these components is entirely ·implementation-defined·. The default presentation modifier for these components is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).464, indicating that they are output as names (or conventional abbreviations), and the chosen names will in many cases depend on the chosen language: see 9.8.4.8 The language, calendar, and place arguments. 9.8.4.8 The language, calendar, and place argumentsThe set of languages, calendars, and places that are supported in the ·date formatting functions· is ·implementation-defined·. When any of these arguments is omitted or is an empty sequence, an ·implementation-defined· default value is used. If the fallback representation uses a different calendar from that requested, the output string must identify the calendar actually used, for example by prefixing the string with fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).549 (where X is the calendar actually used), localized as appropriate to the requested language. If the fallback representation uses a different language from that requested, the output string must identify the language actually used, for example by prefixing the string with fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).550 (where Y is the language actually used) localized in an implementation-dependent way. If a particular component of the value cannot be output in the requested format, it should be output in the default format for that component. The fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 argument specifies the language to be used for the result string of the function. The value of the argument should be either the empty sequence or a value that would be valid for the let $para :=297 attribute (see [XML]). Note that this permits the identification of sublanguages based on country codes (from [ISO 3166-1]) as well as identification of dialects and of regions within a country. If the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 argument is omitted or is set to an empty sequence, or if it is set to an invalid value or a value that the implementation does not recognize, then the processor uses the default language defined in the dynamic context. The language is used to select the appropriate language-dependent forms of:
Where appropriate this choice may also take into account the value of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument, though this should not be used to override the language or any sublanguage that is specified as part of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).556 argument. The choice of the names and abbreviations used in any given language is ·implementation-defined·. For example, one implementation might abbreviate July as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).557 while another uses fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).558. In German, one implementation might represent Saturday as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).559 while another uses fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).560. Implementations may provide mechanisms allowing users to control such choices. Where ordinal numbers are used, the selection of the correct representation of the ordinal (for example, the linguistic gender) may depend on the component being formatted and on its textual context in the picture string. The fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).561 attribute specifies that the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).562, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).563, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).564 supplied in the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 argument must be converted to a value in the specified calendar and then converted to a string using the conventions of that calendar. The calendar value if present must be a valid let $para :=403 (dynamic error: [err:FOFD1340]). If it is a lexical let $para :=86 then it is expanded into an expanded QName using the statically known namespaces; if it has no prefix then it represents an expanded-QName in no namespace. If the expanded QName is in no namespace, then it must identify a calendar with a designator specified below (dynamic error: [err:FOFD1340]). If the expanded QName is in a namespace then it identifies the calendar in an ·implementation-defined· way. If the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).366 argument is omitted or is set to an empty sequence then the default calendar defined in the dynamic context is used. Note: The calendars listed below were known to be in use during the last hundred years. Many other calendars have been used in the past. This specification does not define any of these calendars, nor the way that they map to the value space of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 datatype in [XML Schema Part 2: Datatypes Second Edition]. There may be ambiguities when dates are recorded using different calendars. For example, the start of a new day is not simultaneous in different calendars, and may also vary geographically (for example, based on the time of sunrise or sunset). Translation of dates is therefore more reliable when the time of day is also known, and when the geographic location is known. When translating dates between one calendar and another, the processor may take account of the values of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 and/or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 arguments, with the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument taking precedence. Information about some of these calendars, and algorithms for converting between them, may be found in [Calendrical Calculations]. DesignatorCalendarADAnno Domini (Christian Era)AHAnno Hegirae (Muhammedan Era)AMEMauludi Era (solar years since Mohammed's birth)AMAnno Mundi (Jewish Calendar)APAnno PersiciASAji Saka Era (Java)BEBuddhist EraCBCooch Behar EraCECommon EraCLChinese Lunar EraCSChula Sakarat EraEEEthiopian EraFEFasli EraISOISO 8601 calendarJEJapanese CalendarKEKhalsa Era (Sikh calendar)KYKali YugaMEMalabar EraMSMonarchic Solar EraNSNepal Samwat EraOSOld Style (Julian Calendar)RSRattanakosin (Bangkok) EraSESaka EraSHMohammedan Solar Era (Iran)SSSaka SamvatTETripurabda EraVEVikrama EraVSVikrama Samvat EraAt least one of the above calendars must be supported. It is ·implementation-defined· which calendars are supported. The ISO 8601 calendar ([ISO 8601]), which is included in the above list and designated fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).573, is very similar to the Gregorian calendar designated fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).574, but it differs in several ways. The ISO calendar is intended to ensure that date and time formats can be read easily by other software, as well as being legible for human users. The ISO calendar prescribes the use of particular numbering conventions as defined in ISO 8601, rather than allowing these to be localized on a per-language basis. In particular it provides a numeric 'week date' format which identifies dates by year, week of the year, and day in the week; in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year. The numeric values of the components year, month, day, hour, minute, and second are the same in the ISO calendar as the values used in the lexical representation of the date and time as defined in [XML Schema Part 2: Datatypes Second Edition]. The era ("E" component) with this calendar is either a minus sign (for negative years) or a zero-length string (for positive years). For dates before 1 January, AD 1, year numbers in the ISO and AD calendars are off by one from each other: ISO year 0000 is 1 BC, -0001 is 2 BC, etc. ISO 8601 does not define a numbering for weeks within a month. When the let $para :=278 component is used, the convention to be adopted is that each Monday-to-Sunday week is considered to fall within a particular month if its Thursday occurs in that month; the weeks that fall in a particular month under this definition are numbered starting from 1. Thus, for example, 29 January 2013 falls in week 5 because the Thursday of the week (31 January 2013) is the fifth Thursday in January, and 1 February 2013 is also in week 5 for the same reason. Note: The value space of the date and time datatypes, as defined in XML Schema, is based on absolute points in time. The lexical space of these datatypes defines a representation of these absolute points in time using the proleptic Gregorian calendar, that is, the modern Western calendar extrapolated into the past and the future; but the value space is calendar-neutral. The ·date formatting functions· produce a representation of this absolute point in time, but denoted in a possibly different calendar. So, for example, the date whose lexical representation in XML Schema is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).576 (the day on which Pope Gregory XIII was born) might be formatted using the Old Style (Julian) calendar as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).577. This reflects the fact that there was at that time a ten-day difference between the two calendars. It would be incorrect, and would produce incorrect results, to represent this date in an element or attribute of type op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).579, even though this might reflect the way the date was recorded in contemporary documents. When referring to years occurring in antiquity, modern historians generally use a numbering system in which there is no year zero (the year before 1 CE is thus 1 BCE). This is the convention that should be used when the requested calendar is OS (Julian) or AD (Gregorian). When the requested calendar is ISO, however, the conventions of ISO 8601 should be followed: here the year before +0001 is numbered zero. In [XML Schema Part 2: Datatypes Second Edition] (version 1.0), the value space for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 and let $para :=29 does not include a year zero: however, XSD 1.1 endorses the ISO 8601 convention. This means that the date on which Julius Caesar was assassinated has the ISO 8601 lexical representation -0043-03-13, but will be formatted as 15 March 44 BCE in the Julian calendar or 13 March 44 BCE in the Gregorian calendar (dependant on the chosen localization of the names of months and eras). The intended use of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument is to identify the place where an event represented by the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).562, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).563, or fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).564 supplied in the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 argument took place or will take place. If the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument is omitted or is set to an empty sequence, then the default place defined in the dynamic context is used. If the value is supplied, and is not the empty sequence, then it should either be a country code or an IANA timezone name. If the value does not take this form, or if its value is not recognized by the implementation, then the default place defined in the dynamic context is used.
This argument is not intended to identify the location of the user for whom the date or time is being formatted; that should be done by means of the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).363 attribute. This information may be used to provide additional information when converting dates between calendars or when deciding how individual components of the date and time are to be formatted. For example, different countries using the Old Style (Julian) calendar started the new year on different days, and some countries used variants of the calendar that were out of synchronization as a result of differences in calculating leap years. The geographical area identified by a country code is defined by the boundaries as they existed at the time of the date to be formatted, or the present-day boundaries for dates in the future. If the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument is supplied in the form of an IANA timezone name that is recognized by the implementation, then the date or time being formatted is adjusted to the timezone offset applicable in that timezone. For example, if the let $para :=29 value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).591 is formatted with the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).369 argument set to fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).593, then the output will be as if the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).594 had been supplied. This adjustment takes daylight savings time into account where possible; if the date in question falls during daylight savings time in New York, then it is adjusted to timezone offset fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).595 rather than fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).596. Adjustment using daylight savings time is only possible where the value includes a date, and where the date is within the range covered by the timezone database. 9.8.5 Examples of date and time formattingThe following examples show a selection of dates and times and the way they might be formatted. These examples assume the use of the Gregorian calendar as the default calendar. Required OutputExpressionfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).597 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).598 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).599 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).600 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).601 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).602 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).603 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).604 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).605 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).606 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).607 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).608 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).609 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).610 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).611 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).612 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).613 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).614 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).615 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).616 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).617 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).618 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).619 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).620 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).621 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).622 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).623 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).624 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).625 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).626 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).627 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).628 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).629 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).630 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).631 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).632 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).633 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).634 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).635 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).636 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).637 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).638 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).639 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).640 The following examples use calendars other than the Gregorian calendar. DescriptionRequestResultIslamicfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).641٢٦ ﺸﻭّﺍﻝ ١٤٢٣Jewish (with Western numbering) fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).64226 טבת 5763Jewish (with traditional numbering) fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).643כ״ו טבת תשס״גJulian (Old Style) fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).64418 December 2002Thai fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).645๓๑ ธันวาคม ๒๕๔๕ 9.9 Parsing dates and timesFunctionMeaningfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).646Parses a string containing the date and time in IETF format, returning the corresponding let $para :=29 value. A function is provided to parse dates and times expressed using syntax that is commonly encountered in internet protocols. 9.9.1 fn:parse-ietf-dateSummaryParses a string containing the date and time in IETF format, returning the corresponding let $para :=29 value.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).646( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 let $para :=244) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)038Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function accepts a string matching the production fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).655 in the following grammar: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).655 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).658 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).659 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).661 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).662 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).664 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).665 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).667 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).668 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).670 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).671 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).673 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).676 let $para :=365 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).679 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).680 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).682 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).564 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).685 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).686 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).673 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).689 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).691 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).692 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).694 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)990 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).697 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).698 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).700 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).701 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).703 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)072 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).657 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).706 The input is case-insensitive: upper-case and lower-case distinctions in the above grammar show the conventional usage, but otherwise have no significance. If the input is an empty sequence, the result is an empty sequence. The fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).659, if present, is ignored. The fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).671, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).680, and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)984 supply the day, month, and year of the resulting let $para :=29 value. A two-digit year must have 1900 added to it. A year such as 0070 is to be treated as given; negative years are not permitted. The fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).686, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).689, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).692 (including fractional seconds) values supply the corresponding components of the resulting let $para :=29 value; if the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).692 value or the fractional seconds value is absent then zero is assumed. If both a fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).701 and a fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).698 are supplied then the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).698 is ignored. If a fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).701 is supplied then this defines the hours and minutes parts of the timezone offset:
If a fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).698 is supplied with no fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).701 then it is translated to a timezone offset as follows:tznameOffsetUT, UTC, GMT00:00EST-05:00EDT-04:00CST-06:00CDT-05:00MST-07:00MDT-06:00PST-08:00PDT-07:00 If neither a fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).701 nor fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).698 is supplied, a timezone offset of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).733 is assumed.Error Conditions A dynamic error is raised [err:FORG0010] if the input does not match the grammar, or if the resulting date/time value is invalid (for example, 31 February). NotesThe fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).734 function attempts to interpret its input as a date in any of the three formats specified by HTTP [RFC 2616]. These formats are used widely on the Internet to represent timestamps, and were specified in:
[RFC 2616] (HTTP) officially uses a subset of those three formats restricted to GMT. The grammar for this function is slightly more liberal than the RFCs (reflecting the internet tradition of being liberal in what is accepted). For example the function:
In new protocols IETF recommends the format of [RFC 3339] which is based on a profile of ISO 8601 similar to that already used in XPath and XSD, but the "approximate" [RFC 822] format described here is very widely used. An [RFC 1123] date can be generated approximately using fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).340 with a picture string of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).737.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).738 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).739. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).740 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).739. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).742 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).743. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).744 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).745. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).746 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).747. 10 Functions related to QNames10.1 Functions to create a QNameIn addition to the let $para :=36 constructor function, QName values can be constructed by combining a namespace URI, prefix, and local name, or by resolving a lexical QName against the in-scope namespaces of an element node. This section defines these functions. Leading and trailing whitespace, if present, is stripped from string arguments before the result is constructed.FunctionMeaning fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).749Returns an let $para :=36 value (that is, an expanded-QName) by taking an let $para :=10 that has the lexical form of an let $para :=36 (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).753Returns an let $para :=36 value formed using a supplied namespace URI and lexical QName. 10.1.1 fn:resolve-QNameSummaryReturns an let $para :=36 value (that is, an expanded-QName) by taking an let $para :=10 that has the lexical form of an let $para :=36 (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).749( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 let $para :=71 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).764) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759 is the empty sequence, returns the empty sequence. More specifically, the function searches the namespace bindings of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 for a binding whose name matches the prefix of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759, or the zero-length string if it has no prefix, and returns an expanded-QName whose local name is taken from the supplied fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759, and whose namespace URI is taken from the string value of the namespace binding. If the fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759 has no prefix, and there is no namespace binding for fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 corresponding to the default (unnamed) namespace, then the resulting expanded-QName has no namespace part. The prefix (or absence of a prefix) in the supplied fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759 argument is retained in the returned expanded-QName, as described in Section 2.1 Terminology DM31.Error Conditions A dynamic error is raised [err:FOCA0002] if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759 does not have the correct lexical form for an instance of let $para :=36. A dynamic error is raised [err:FONS0004] if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).759 has a prefix and there is no namespace binding for fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 that matches this prefix.Notes Sometimes the requirement is to construct an let $para :=36 without using the default namespace. This can be achieved by writing: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)0 If the requirement is to construct an let $para :=36 using the namespaces in the static context, then the let $para :=36 constructor should be used.Examples Assume that the element bound to fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 has a single namespace binding bound to the prefix fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).782. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).783 returns a QName with local name "hello" that is in no namespace. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).784 returns an let $para :=36 whose namespace URI is specified by the namespace binding corresponding to the prefix "eg" and whose local name is "myFunc". 10.1.2 fn:QNameSummaryReturns an let $para :=36 value formed using a supplied namespace URI and lexical QName.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).753( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).788 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).791 let $para :=71 let $para :=10) let $para :=71 let $para :=36Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe namespace URI in the returned QName is taken from fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).788. If fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).788 is the zero-length string or the empty sequence, it represents "no namespace". The prefix (or absence of a prefix) in fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).791 is retained in the returned let $para :=36 value. The local name in the result is taken from the local part of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).791.Error Conditions A dynamic error is raised [err:FOCA0002] if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).791 does not have the correct lexical form for an instance of let $para :=36. A dynamic error is raised [err:FOCA0002] if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).788 is the zero-length string or the empty sequence, and the value of fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).791 contains a colon ( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).805). A dynamic error may be raised [err:FOCA0002] if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).788 is not a valid URI (XML Namespaces 1.0) or IRI (XML Namespaces 1.1).Examples fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).807 returns an let $para :=36 with namespace URI = "http://www.example.com/example", local name = "person" and prefix = "". fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).809 returns an let $para :=36 with namespace URI = "http://www.example.com/example", local name = "person" and prefix = "ht". 10.2 Functions and operators related to QNamesThis section specifies functions on QNames as defined in [XML Schema Part 2: Datatypes Second Edition]. FunctionMeaningfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).811Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if two supplied QNames have the same namespace URI and the same local part. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).813Returns the prefix component of the supplied QName. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).814Returns the local part of the supplied QName. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).815Returns the namespace URI part of the supplied QName. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).816Returns the namespace URI of one of the in-scope namespaces for fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762, identified by its namespace prefix. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).818Returns the prefixes of the in-scope namespaces for an element node. 10.2.1 op:QName-equalSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if two supplied QNames have the same namespace URI and the same local part.Operator Mapping Defines the semantics of the "eq" and "ne" operators when applied to two values of type let $para :=36.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).811( let $para :=70 let $para :=71 let $para :=36, let $para :=73 let $para :=71 let $para :=36) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the namespace URIs of let $para :=70 and let $para :=73 are equal and the local names of let $para :=70 and let $para :=73 are equal. Otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The namespace URI parts are considered equal if they are both absentDM31, or if they are both present and equal under the rules of the let $para :=061 function. The local parts are also compared under the rules of the let $para :=061 function.Notes The prefix parts of let $para :=70 and let $para :=73, if any, are ignored. 10.2.2 fn:prefix-from-QNameSummaryReturns the prefix component of the supplied QName. Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).813( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47) let $para :=71 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).845Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence the function returns the empty sequence. If let $para :=25 has no prefix component the function returns the empty sequence. Otherwise, the function returns an let $para :=35 representing the prefix component of let $para :=25. 10.2.3 fn:local-name-from-QNameSummaryReturns the local part of the supplied QName. Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).814( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47) let $para :=71 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).845Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence the function returns the empty sequence. Otherwise, the function returns an let $para :=35 representing the local part of let $para :=25.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).859 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).860. 10.2.4 fn:namespace-uri-from-QNameSummaryReturns the namespace URI part of the supplied QName. Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).815( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence the function returns the empty sequence. Otherwise, the function returns an let $para :=30 representing the namespace URI part of let $para :=25. If let $para :=25 is in no namespace, the function returns the zero-length let $para :=30.Examples The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).872 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).873. 10.2.5 fn:namespace-uri-for-prefixSummaryReturns the namespace URI of one of the in-scope namespaces for fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762, identified by its namespace prefix.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).816( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).876 let $para :=71 let $para :=244, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 let $para :=71 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).764) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 has an in-scope namespace whose namespace prefix is equal to fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).876, the function returns the namespace URI of that namespace. If fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 has no in-scope namespace whose namespace prefix is equal to fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).876, the function returns the empty sequence. If fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).876 is the zero-length string or the empty sequence, then if fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 has a default namespace (that is, a namespace node with no name), the function returns the namespace URI of the default namespace. If fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 has no default namespace, the function returns the empty sequence. Prefixes are equal only if their Unicode codepoints match exactly. Examplesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)1 The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).891 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).892. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).893 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).894. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).895 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).894. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).897 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).898. The expression fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).897 returns fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).898. 10.2.6 fn:in-scope-prefixesSummaryReturns the prefixes of the in-scope namespaces for an element node. Signaturefn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).818( fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762 let $para :=71 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).764) let $para :=71 let $para :=234Properties This function is ·nondeterministic-wrt-ordering·, ·context-independent·, and ·focus-independent·. RulesThe function returns a sequence of strings representing the prefixes of the in-scope namespaces for fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).762. For namespace bindings that have a prefix, the function returns the prefix as an let $para :=35. For the default namespace, which has no prefix, it returns the zero-length string. The result sequence contains no duplicates. The ordering of the result sequence is ·implementation-dependent·. NotesThe XML namespace is in scope for every element, so the result will always include the string "xml". 11 Operators on base64Binary and hexBinary11.1 Comparisons of base64Binary and hexBinary valuesThe following comparison operators on let $para :=196 and let $para :=219 values are defined. Comparisons take two operands of the same type; that is, both operands must be let $para :=196 or both operands may be let $para :=219. Each returns a boolean value. A value of type let $para :=219 can be compared with a value of type let $para :=196 by casting one value to the other type. See 19.1.6 Casting to xs:base64Binary and xs:hexBinary.FunctionMeaning fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).915Returns true if two let $para :=219 values contain the same octet sequence. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).917Returns true if the first argument is less than the second. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).918Returns true if the first argument is greater than the second. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).919Returns true if two let $para :=196 values contain the same octet sequence. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).921Returns true if the first argument is less than the second. fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).922Returns true if the first argument is greater than the second. 11.1.1 op:hexBinary-equalSummaryReturns true if two let $para :=219 values contain the same octet sequence.Operator Mapping Defines the semantics of the "eq" and "ne" operators when applied to two let $para :=219 values.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).915( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)368 let $para :=71 let $para :=219, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)371 let $para :=71 let $para :=219) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)368 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)371 are of the same length, measured in binary octets, and contain the same octets in the same order. Otherwise, it returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 11.1.2 op:hexBinary-less-thanSummaryReturns true if the first argument is less than the second. Operator MappingDefines the semantics of the "lt" operator when applied to two let $para :=219 values. Also used in the definition of the "ge" operator.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).917( let $para :=70 let $para :=71 let $para :=219, let $para :=73 let $para :=71 let $para :=219) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if any of the following conditions is true:
Otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 11.1.3 op:hexBinary-greater-thanSummaryReturns true if the first argument is greater than the second. Operator MappingDefines the semantics of the "gt" operator when applied to two let $para :=219 values. Also used in the definition of the "le" operator.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).918( let $para :=70 let $para :=71 let $para :=219, let $para :=73 let $para :=71 let $para :=219) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function call fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).970 is defined to return the same result as fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).971 11.1.4 op:base64Binary-equalSummaryReturns true if two let $para :=196 values contain the same octet sequence.Operator Mapping Defines the semantics of the "eq" and "ne" operators when applied to two let $para :=196 values.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).919( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)368 let $para :=71 let $para :=196, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)371 let $para :=71 let $para :=196) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)368 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)371 are of the same length, measured in binary octets, and contain the same octets in the same order. Otherwise, it returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 11.1.5 op:base64Binary-less-thanSummaryReturns true if the first argument is less than the second. Operator MappingDefines the semantics of the "lt" operator when applied to two let $para :=196 values. Also used in the definition of the "ge" operator.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).921( let $para :=70 let $para :=71 let $para :=196, let $para :=73 let $para :=71 let $para :=196) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if any of the following conditions is true:
Otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. 11.1.6 op:base64Binary-greater-thanSummaryReturns true if the first argument is greater than the second. Operator MappingDefines the semantics of the "gt" operator when applied to two let $para :=196 values. Also used in the definition of the "le" operator.Signature fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).922( let $para :=70 let $para :=71 let $para :=196, let $para :=73 let $para :=71 let $para :=196) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function call 1º 2º 3º 4º ...019 is defined to return the same result as 1º 2º 3º 4º ...020 12 Operators on NOTATIONThis section specifies operators that take 1º 2º 3º 4º ...021 values as arguments.FunctionMeaning 1º 2º 3º 4º ...022Returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the two 1º 2º 3º 4º ...021 values have the same namespace URI and the same local part. 12.1 op:NOTATION-equalSummaryReturns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the two 1º 2º 3º 4º ...021 values have the same namespace URI and the same local part.Operator Mapping Defines the semantics of the "eq" and "ne" operators when applied to two values of type 1º 2º 3º 4º ...021.Signature 1º 2º 3º 4º ...022( let $para :=70 let $para :=71 1º 2º 3º 4º ...021, let $para :=73 let $para :=71 1º 2º 3º 4º ...021) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Rules The function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the namespace URIs of let $para :=70 and let $para :=73 are equal and the local names of let $para :=70 and let $para :=73 are equal. Otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. The namespace URI parts are considered equal if they are both absentDM31, or if they are both present and equal under the rules of the let $para :=061 function. The local parts are also compared under the rules of the let $para :=061 function.Notes The prefix parts of let $para :=70 and let $para :=73, if any, are ignored. 13 Functions and operators on nodesThis section specifies functions and operators on nodes. Nodes are formally defined in Section 6 Nodes DM31. FunctionMeaninglet $para :=38Returns the name of a node, as an let $para :=10 that is either the zero-length string, or has the lexical form of an let $para :=36. 1º 2º 3º 4º ...050Returns the local part of the name of let $para :=25 as an let $para :=10 that is either the zero-length string, or has the lexical form of an let $para :=35. 1º 2º 3º 4º ...054Returns the namespace URI part of the name of let $para :=25, as an let $para :=30 value. 1º 2º 3º 4º ...057This function tests whether the language of 1º 2º 3º 4º ...058, or the context item if the second argument is omitted, as specified by let $para :=297 attributes is the same as, or is a sublanguage of, the language specified by 1º 2º 3º 4º ...060. 1º 2º 3º 4º ...061Returns the root of the tree to which let $para :=25 belongs. This will usually, but not necessarily, be a document node. 1º 2º 3º 4º ...063Returns a path expression that can be used to select the supplied node relative to the root of its containing document. 1º 2º 3º 4º ...064Returns true if the supplied node has one or more child nodes (of any kind). 1º 2º 3º 4º ...065Returns every node within the input sequence that is not an ancestor of another member of the input sequence; the nodes are returned in document order with duplicates eliminated. 1º 2º 3º 4º ...066Returns every node within the input sequence that has no ancestor that is itself a member of the input sequence; the nodes are returned in document order with duplicates eliminated. For the illustrative examples below assume an XQuery or transformation operating on a 1º 2º 3º 4º ...067 document containing a number of 1º 2º 3º 4º ...068 elements. Each line-item has child elements called 1º 2º 3º 4º ...069, 1º 2º 3º 4º ...070, 1º 2º 3º 4º ...071, etc. whose content is different for each 1º 2º 3º 4º ...068. Quantity has simple content of type let $para :=82. Further assume that variables 1º 2º 3º 4º ...074, 1º 2º 3º 4º ...075, etc. are each bound to single line-item element nodes in the document in sequence and that the value of the quantity child of the first line-item is 1º 2º 3º 4º ...076. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)2 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)3 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)4 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)5 13.1 fn:nameSummaryReturns the name of a node, as an let $para :=10 that is either the zero-length string, or has the lexical form of an let $para :=36.Signatures let $para :=38() let $para :=71 let $para :=10 let $para :=38( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 let $para :=10Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the node identified by let $para :=25 has no name (that is, if it is a document node, a comment, a text node, or a namespace node having no name), the function returns the zero-length string. Otherwise, the function returns the value of the expression 1º 2º 3º 4º ...090.Error Conditions The following errors may be raised when let $para :=25 is omitted:
Because the result depends on the choice of namespace prefixes in the source document, it is not good practice to use the result of this function for anything other than display purposes. For example, the test 1º 2º 3º 4º ...092 will fail if the source document uses an unexpected namespace prefix. Such a test (assuming it relates to an element node) is better written as 1º 2º 3º 4º ...093. 13.2 fn:local-nameSummaryReturns the local part of the name of let $para :=25 as an let $para :=10 that is either the zero-length string, or has the lexical form of an let $para :=35.Signatures 1º 2º 3º 4º ...050() let $para :=71 let $para :=10 1º 2º 3º 4º ...050( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 let $para :=10Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the node identified by let $para :=25 has no name (that is, if it is a document node, a comment, a text node, or a namespace node having no name), the function returns the zero-length string. Otherwise, the function returns the local part of the expanded-QName of the node identified by let $para :=25, as determined by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)56 accessor defined in Section 5.10 node-name Accessor DM31). This will be an let $para :=10 whose lexical form is an let $para :=35.Error Conditions The following errors may be raised when let $para :=25 is omitted:
13.3 fn:namespace-uriSummaryReturns the namespace URI part of the name of let $para :=25, as an let $para :=30 value.Signatures 1º 2º 3º 4º ...054() let $para :=71 let $para :=30 1º 2º 3º 4º ...054( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 let $para :=30Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context node ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If the node identified by let $para :=25 is neither an element nor an attribute node, or if it is an element or attribute node whose expanded-QName (as determined by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)56 accessor in the Section 5.10 node-name Accessor DM31) is in no namespace, then the function returns the zero-length let $para :=30 value. Otherwise, the result will be the namespace URI part of the expanded-QName of the node identified by let $para :=25, as determined by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)56 accessor defined in Section 5.10 node-name Accessor DM31), returned as an let $para :=30 value.Error Conditions The following errors may be raised when let $para :=25 is omitted:
13.4 fn:langSummaryThis function tests whether the language of 1º 2º 3º 4º ...058, or the context item if the second argument is omitted, as specified by let $para :=297 attributes is the same as, or is a sublanguage of, the language specified by 1º 2º 3º 4º ...060.Signatures 1º 2º 3º 4º ...057( 1º 2º 3º 4º ...060 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 1º 2º 3º 4º ...057( 1º 2º 3º 4º ...060 let $para :=71 let $para :=244, 1º 2º 3º 4º ...058 let $para :=71 1º 2º 3º 4º ...147) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe behavior of the function if the second argument is omitted is exactly the same as if the context item ( let $para :=19) had been passed as the second argument. The language of the argument 1º 2º 3º 4º ...058, or the context item if the second argument is omitted, is determined by the value of the let $para :=297 attribute on the node, or, if the node has no such attribute, by the value of the let $para :=297 attribute on the nearest ancestor of the node that has an let $para :=297 attribute. If there is no such ancestor, then the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. If 1º 2º 3º 4º ...060 is the empty sequence it is interpreted as the zero-length string. The relevant let $para :=297 attribute is determined by the value of the XPath expression: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)6 If this expression returns an empty sequence, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. Otherwise, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if, based on a caseless default match as specified in section 3.13 of [The Unicode Standard], either:
The following errors may be raised when let $para :=25 is omitted:
The expression 1º 2º 3º 4º ...165 would return op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if the context node were any of the following four elements:
The expression 1º 2º 3º 4º ...171 would return let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 if the context node were 1º 2º 3º 4º ...169 13.5 fn:rootSummaryReturns the root of the tree to which let $para :=25 belongs. This will usually, but not necessarily, be a document node.Signatures 1º 2º 3º 4º ...061() let $para :=71 1º 2º 3º 4º ...147 1º 2º 3º 4º ...061( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the function is called without an argument, the context item ( let $para :=19) is used as the default argument. The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The function returns the value of the expression 1º 2º 3º 4º ...185.Error Conditions The following errors may be raised when let $para :=25 is omitted:
These examples use some variables which could be defined in [XQuery 3.1: An XML Query Language] as: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)7 Or they could be defined in [XSL Transformations (XSLT) Version 3.0] as: op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)8 1º 2º 3º 4º ...187 returns the element node 1º 2º 3º 4º ...188 1º 2º 3º 4º ...189 returns the element node 1º 2º 3º 4º ...190 1º 2º 3º 4º ...191 returns the document node 1º 2º 3º 4º ...192 1º 2º 3º 4º ...193 returns the element node 1º 2º 3º 4º ...190 The final three examples could be made type-safe by wrapping their operands with 1º 2º 3º 4º ...195. 13.6 fn:pathSummaryReturns a path expression that can be used to select the supplied node relative to the root of its containing document. Signatures1º 2º 3º 4º ...063() let $para :=71 let $para :=244 1º 2º 3º 4º ...063( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 let $para :=244Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe behavior of the function if the argument is omitted is exactly the same as if the context item ( let $para :=19) had been passed as the argument. If let $para :=25 is the empty sequence, the function returns the empty sequence. If let $para :=25 is a document node, the function returns the string 1º 2º 3º 4º ...208. Otherwise, the function returns a string that consists of a sequence of steps, one for each ancestor-or-self of let $para :=25 other than the root node. This string is prefixed by 1º 2º 3º 4º ...210 if the root node is not a document node. Each step consists of the character 1º 2º 3º 4º ...208 followed by a string whose form depends on the kind of node selected by that step, as follows:
The following errors may be raised when let $para :=25 is omitted:
op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)9 The expression 1º 2º 3º 4º ...232 returns 1º 2º 3º 4º ...233. The expression 1º 2º 3º 4º ...234 returns 1º 2º 3º 4º ...235. The expression 1º 2º 3º 4º ...236 returns 1º 2º 3º 4º ...237. The expression 1º 2º 3º 4º ...238 returns 1º 2º 3º 4º ...239. The expression 1º 2º 3º 4º ...240 returns 1º 2º 3º 4º ...241. The expression 1º 2º 3º 4º ...242 returns 1º 2º 3º 4º ...243. op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)0 The expression 1º 2º 3º 4º ...244 returns 1º 2º 3º 4º ...245. The expression 1º 2º 3º 4º ...246 returns 1º 2º 3º 4º ...247. The expression 1º 2º 3º 4º ...248 returns 1º 2º 3º 4º ...249. 13.7 fn:has-childrenSummaryReturns true if the supplied node has one or more child nodes (of any kind). Signatures1º 2º 3º 4º ...064() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 1º 2º 3º 4º ...064( 1º 2º 3º 4º ...058 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. Provided that the supplied argument 1º 2º 3º 4º ...058 matches the expected type op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51, the result of the function call 1º 2º 3º 4º ...262 is defined to be the same as the result of the expression 1º 2º 3º 4º ...263.Error Conditions The following errors may be raised when 1º 2º 3º 4º ...058 is omitted:
If 1º 2º 3º 4º ...058 is an empty sequence the result is false. The motivation for this function is to support streamed evaluation. According to the streaming rules in [XSL Transformations (XSLT) Version 3.0], the following construct is not streamable: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)1 This is because it makes two downward selections to read the child 1º 2º 3º 4º ...266 elements. The use of 1º 2º 3º 4º ...064 in the 1º 2º 3º 4º ...268 conditional is intended to circumvent this restriction. Although the function was introduced to support streaming use cases, it has general utility as a convenience function. 13.8 fn:innermostSummaryReturns every node within the input sequence that is not an ancestor of another member of the input sequence; the nodes are returned in document order with duplicates eliminated. Signature1º 2º 3º 4º ...065( 1º 2º 3º 4º ...270 let $para :=71 1º 2º 3º 4º ...272) let $para :=71 1º 2º 3º 4º ...272Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of the function call 1º 2º 3º 4º ...275 is defined to be equivalent to the result of the expression: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)2 That is, the function takes as input a sequence of nodes, and returns every node within the sequence that is not an ancestor of another node within the sequence; the nodes are returned in document order with duplicates eliminated. ExamplesIf the source document contains nested sections represented by 1º 2º 3º 4º ...276 elements, the expression 1º 2º 3º 4º ...277 returns those 1º 2º 3º 4º ...276 elements that do not contain further 1º 2º 3º 4º ...276 elements. 13.9 fn:outermostSummaryReturns every node within the input sequence that has no ancestor that is itself a member of the input sequence; the nodes are returned in document order with duplicates eliminated. Signature1º 2º 3º 4º ...066( 1º 2º 3º 4º ...270 let $para :=71 1º 2º 3º 4º ...272) let $para :=71 1º 2º 3º 4º ...272Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of the function call 1º 2º 3º 4º ...286 is defined to be equivalent to the result of the expression: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)3 That is, the function takes as input a sequence of nodes, and returns every node within the sequence that does not have another node within the sequence as an ancestor; the nodes are returned in document order with duplicates eliminated. NotesThe formulation 1º 2º 3º 4º ...287 might appear to be simpler, but does not correctly account for attribute nodes, as these are not descendants of their parent element. The motivation for the function was based on XSLT streaming use cases. There are cases where the [XSL Transformations (XSLT) Version 3.0] streaming rules allow the construct 1º 2º 3º 4º ...288 but do not allow 1º 2º 3º 4º ...289; the function can therefore be useful in cases where it is known that sections will not be nested, as well as cases where the application actually wishes to process all sections except those that are nested within another.Examples If the source document contains nested sections represented by 1º 2º 3º 4º ...276 elements, the expression 1º 2º 3º 4º ...291 returns those 1º 2º 3º 4º ...276 elements that are not contained within further 1º 2º 3º 4º ...276 elements. 14 Functions and operators on sequencesA 1º 2º 3º 4º ...294 is an ordered collection of zero or more 1º 2º 3º 4º ...295. An 1º 2º 3º 4º ...296 is either a node or an atomic value. The terms 1º 2º 3º 4º ...294 and 1º 2º 3º 4º ...296 are defined formally in [XQuery 3.1: An XML Query Language] and [XML Path Language (XPath) 3.1]. 14.1 General functions and operators on sequencesThe following functions are defined on sequences. These functions work on any sequence, without performing any operations that are sensitive to the individual items in the sequence. FunctionMeaning1º 2º 3º 4º ...299Returns true if the argument is the empty sequence. 1º 2º 3º 4º ...300Returns true if the argument is a non-empty sequence. 1º 2º 3º 4º ...301Returns the first item in a sequence. 1º 2º 3º 4º ...302Returns all but the first item in a sequence. 1º 2º 3º 4º ...303Returns a sequence constructed by inserting an item or a sequence of items at a given position within an existing sequence. 1º 2º 3º 4º ...304Returns a new sequence containing all the items of 1º 2º 3º 4º ...305 except the item at position 1º 2º 3º 4º ...306. 1º 2º 3º 4º ...307Reverses the order of items in a sequence. 1º 2º 3º 4º ...308Returns the contiguous sequence of items in the value of 1º 2º 3º 4º ...309 beginning at the position indicated by the value of 1º 2º 3º 4º ...310 and continuing for the number of items indicated by the value of let $para :=275. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)15Returns the items of 1º 2º 3º 4º ...309 in an ·implementation-dependent· order. As in the previous section, for the illustrative examples below, assume an XQuery or transformation operating on a non-empty Purchase Order document containing a number of line-item elements. The variable let $para :=021 is bound to the sequence of line-item nodes in document order. The variables 1º 2º 3º 4º ...074, 1º 2º 3º 4º ...075, etc. are bound to separate, individual line-item nodes in the sequence. 14.1.1 fn:emptySummaryReturns true if the argument is the empty sequence. Signature1º 2º 3º 4º ...299( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is the empty sequence, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76; otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07.Examples The expression 1º 2º 3º 4º ...326 returns let $para :=182. The expression 1º 2º 3º 4º ...328 returns let $para :=184. The expression 1º 2º 3º 4º ...330 returns let $para :=184. The expression 1º 2º 3º 4º ...332 returns let $para :=184. The expression 1º 2º 3º 4º ...334 returns let $para :=184. Assuming 1º 2º 3º 4º ...336 is an element with no children: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)4 The result is let $para :=184. 14.1.2 fn:existsSummaryReturns true if the argument is a non-empty sequence. Signature1º 2º 3º 4º ...300( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the value of let $para :=25 is a non-empty sequence, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76; otherwise, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07.Examples The expression 1º 2º 3º 4º ...347 returns let $para :=184. The expression 1º 2º 3º 4º ...349 returns let $para :=182. The expression 1º 2º 3º 4º ...351 returns let $para :=182. The expression 1º 2º 3º 4º ...353 returns let $para :=182. The expression 1º 2º 3º 4º ...355 returns let $para :=182. Assuming 1º 2º 3º 4º ...336 is an element with no children: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)5 The result is let $para :=182. 14.1.3 fn:headSummaryReturns the first item in a sequence. Signature1º 2º 3º 4º ...301( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 let $para :=79Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the value of the expression 1º 2º 3º 4º ...365Notes If let $para :=25 is the empty sequence, the empty sequence is returned. Otherwise the first item in the sequence is returned.Examples The expression 1º 2º 3º 4º ...367 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The expression 1º 2º 3º 4º ...369 returns 1º 2º 3º 4º ...370. The expression 1º 2º 3º 4º ...371 returns let $para :=96. The expression 1º 2º 3º 4º ...373 returns 1º 2º 3º 4º ...374. 14.1.4 fn:tailSummaryReturns all but the first item in a sequence. Signature1º 2º 3º 4º ...302( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the value of the expression 1º 2º 3º 4º ...381Notes If let $para :=25 is the empty sequence, or a sequence containing a single item, then the empty sequence is returned.Examples The expression 1º 2º 3º 4º ...383 returns 1º 2º 3º 4º ...384. The expression 1º 2º 3º 4º ...385 returns 1º 2º 3º 4º ...386. The expression 1º 2º 3º 4º ...387 returns let $para :=96. The expression 1º 2º 3º 4º ...389 returns let $para :=96. The expression 1º 2º 3º 4º ...391 returns let $para :=96. 14.1.5 fn:insert-beforeSummaryReturns a sequence constructed by inserting an item or a sequence of items at a given position within an existing sequence. Signature1º 2º 3º 4º ...303( 1º 2º 3º 4º ...305 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...306 let $para :=71 let $para :=85, 1º 2º 3º 4º ...400 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe value returned by the function consists of all items of 1º 2º 3º 4º ...305 whose index is less than 1º 2º 3º 4º ...306, followed by all items of 1º 2º 3º 4º ...400, followed by the remaining elements of 1º 2º 3º 4º ...305, in that order.Notes If 1º 2º 3º 4º ...305 is the empty sequence, 1º 2º 3º 4º ...400 is returned. If 1º 2º 3º 4º ...400 is the empty sequence, 1º 2º 3º 4º ...305 is returned. If 1º 2º 3º 4º ...306 is less than one (1), the first position, the effective value of 1º 2º 3º 4º ...306 is one (1). If 1º 2º 3º 4º ...306 is greater than the number of items in 1º 2º 3º 4º ...305, then the effective value of 1º 2º 3º 4º ...306 is equal to the number of items in 1º 2º 3º 4º ...305 plus 1. The value of 1º 2º 3º 4º ...305 is not affected by the sequence construction.Examples op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)6 The expression 1º 2º 3º 4º ...420 returns 1º 2º 3º 4º ...421. The expression 1º 2º 3º 4º ...422 returns 1º 2º 3º 4º ...421. The expression 1º 2º 3º 4º ...424 returns 1º 2º 3º 4º ...425. The expression 1º 2º 3º 4º ...426 returns 1º 2º 3º 4º ...427. The expression 1º 2º 3º 4º ...428 returns 1º 2º 3º 4º ...429. 14.1.6 fn:removeSummaryReturns a new sequence containing all the items of 1º 2º 3º 4º ...305 except the item at position 1º 2º 3º 4º ...306.Signature 1º 2º 3º 4º ...304( 1º 2º 3º 4º ...305 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...306 let $para :=71 let $para :=85) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns a sequence consisting of all items of 1º 2º 3º 4º ...305 whose index is less than 1º 2º 3º 4º ...306, followed by all items of 1º 2º 3º 4º ...305 whose index is greater than 1º 2º 3º 4º ...306.Notes If 1º 2º 3º 4º ...306 is less than 1 or greater than the number of items in 1º 2º 3º 4º ...305, 1º 2º 3º 4º ...305 is returned. If 1º 2º 3º 4º ...305 is the empty sequence, the empty sequence is returned.Examples op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)6 The expression 1º 2º 3º 4º ...449 returns 1º 2º 3º 4º ...450. The expression 1º 2º 3º 4º ...451 returns 1º 2º 3º 4º ...386. The expression 1º 2º 3º 4º ...453 returns 1º 2º 3º 4º ...450. The expression 1º 2º 3º 4º ...455 returns let $para :=96. 14.1.7 fn:reverseSummaryReverses the order of items in a sequence. Signature1º 2º 3º 4º ...307( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns a sequence containing the items in let $para :=25 in reverse order.Notes If let $para :=25 is the empty sequence, the empty sequence is returned.Examples op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)6 The expression 1º 2º 3º 4º ...465 returns 1º 2º 3º 4º ...466. The expression 1º 2º 3º 4º ...467 returns 1º 2º 3º 4º ...468. The expression 1º 2º 3º 4º ...469 returns let $para :=96. The expression 1º 2º 3º 4º ...471 returns 1º 2º 3º 4º ...374. (The input is a sequence containing a single item (the array)). The expression 1º 2º 3º 4º ...473 returns 1º 2º 3º 4º ...474. 14.1.8 fn:subsequenceSummaryReturns the contiguous sequence of items in the value of 1º 2º 3º 4º ...309 beginning at the position indicated by the value of 1º 2º 3º 4º ...310 and continuing for the number of items indicated by the value of let $para :=275.Signatures 1º 2º 3º 4º ...308( 1º 2º 3º 4º ...309 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...310 let $para :=71 let $para :=26) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16 1º 2º 3º 4º ...308( 1º 2º 3º 4º ...309 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...310 let $para :=71 let $para :=26, let $para :=275 let $para :=71 let $para :=26) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIn the two-argument case, returns: op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)9 In the three-argument case, returns: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).0Notes The first item of a sequence is located at position 1, not position 0. If 1º 2º 3º 4º ...309 is the empty sequence, the empty sequence is returned. In the two-argument case, the function returns a sequence comprising those items of 1º 2º 3º 4º ...309 whose index position (counting from one) is greater than or equal to the value of 1º 2º 3º 4º ...310 (rounded to an integer). No error occurs if 1º 2º 3º 4º ...310 is zero or negative. In the three-argument case, The function returns a sequence comprising those items of 1º 2º 3º 4º ...309 whose index position (counting from one) is greater than or equal to the value of 1º 2º 3º 4º ...310 (rounded to an integer), and less than the sum of 1º 2º 3º 4º ...310 and let $para :=275 (both rounded to integers). No error occurs if 1º 2º 3º 4º ...310 is zero or negative, or if 1º 2º 3º 4º ...310 plus let $para :=275 exceeds the number of items in the sequence, or if let $para :=275 is negative. As a consequence of the general rules, if 1º 2º 3º 4º ...310 is 1º 2º 3º 4º ...57 and let $para :=275 is let $para :=27, then 1º 2º 3º 4º ...515 is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90; since 1º 2º 3º 4º ...517 is always false, the result is an empty sequence. The reason the function accepts arguments of type let $para :=26 is that many computations on untyped data return an let $para :=26 result; and the reason for the rounding rules is to compensate for any imprecision in these floating-point computations.Examples fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).1 The expression 1º 2º 3º 4º ...520 returns 1º 2º 3º 4º ...521. The expression 1º 2º 3º 4º ...522 returns 1º 2º 3º 4º ...523. 14.1.9 fn:unorderedSummaryReturns the items of 1º 2º 3º 4º ...309 in an ·implementation-dependent· order.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)15( 1º 2º 3º 4º ...309 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·nondeterministic-wrt-ordering·, ·context-independent·, and ·focus-independent·. RulesThe function returns the items of 1º 2º 3º 4º ...309 in an ·implementation-dependent· order.Notes Query optimizers may be able to do a better job if the order of the output sequence is not specified. For example, when retrieving prices from a purchase order, if an index exists on prices, it may be more efficient to return the prices in index order rather than in document order. ExamplesThe expression 1º 2º 3º 4º ...532 returns some permutation of 1º 2º 3º 4º ...533. 14.2 Functions that compare values in sequencesThe functions in this section rely on comparisons between the items in one or more sequences. FunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)14Returns the values that appear in a sequence, with duplicates eliminated. 1º 2º 3º 4º ...535Returns a sequence of positive integers giving the positions within the sequence let $para :=021 of items that are equal to 1º 2º 3º 4º ...537. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)23This function assesses whether two sequences are deep-equal to each other. To be deep-equal, they must contain items that are pairwise deep-equal; and for two items to be deep-equal, they must either be atomic values that compare equal, or nodes of the same kind, with the same name, whose children are deep-equal, or maps with matching entries, or arrays with matching members. 14.2.1 fn:distinct-valuesSummaryReturns the values that appear in a sequence, with duplicates eliminated. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)14( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)14( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, let $para :=128 let $para :=71 let $para :=10) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12Properties The one-argument form of this function is ·nondeterministic-wrt-ordering·, ·context-dependent·, and ·focus-independent·. It depends on collations, and implicit timezone. The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI, and implicit timezone. RulesThe function returns the sequence that results from removing from let $para :=25 all but one of a set of values that are considered equal to one another. Two items $J and $K in the input sequence (after atomization, as required by the function signature) are considered equal if 1º 2º 3º 4º ...555 is true, where 1º 2º 3º 4º ...556 is the collation selected according to the rules in 5.3.5 Choosing a collation. This collation is used when string comparison is required. The order in which the sequence of values is returned is ·implementation-dependent·. Which value of a set of values that compare equal is returned is ·implementation-dependent·. If the input sequence contains values of different numeric types that differ from each other by small amounts, then the eq operator is not transitive, because of rounding effects occurring during type promotion. In the situation where the input contains three values let $para :=51, 1º 2º 3º 4º ...558, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).546 such that 1º 2º 3º 4º ...560, 1º 2º 3º 4º ...561, but 1º 2º 3º 4º ...562, then the number of items in the result of the function (as well as the choice of which items are returned) is ·implementation-dependent·, subject only to the constraints that (a) no two items in the result sequence compare equal to each other, and (b) every input item that does not appear in the result sequence compares equal to some item that does appear in the result sequence. For example, this arises when computing: fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).2 because the values of type let $para :=83 and let $para :=26 both compare equal to the value of type let $para :=82 but not equal to each other.Notes If let $para :=25 is the empty sequence, the function returns the empty sequence. Values of type let $para :=00 are compared as if they were of type let $para :=10. Values that cannot be compared, because the let $para :=33 operator is not defined for their types, are considered to be distinct. For let $para :=83 and let $para :=26 values, positive zero is equal to negative zero and, although fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 does not equal itself, if let $para :=25 contains multiple fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 values a single fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned. If let $para :=29, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 or op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Note that let $para :=29, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 or op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 values can compare equal even if their timezones are different.Examples The expression 1º 2º 3º 4º ...582 returns some permutation of 1º 2º 3º 4º ...583. (The result may include either the let $para :=85 2 or the let $para :=82 2.0). The expression 1º 2º 3º 4º ...586 returns some permutation of 1º 2º 3º 4º ...587. 14.2.2 fn:index-ofSummaryReturns a sequence of positive integers giving the positions within the sequence let $para :=021 of items that are equal to 1º 2º 3º 4º ...537.Signatures 1º 2º 3º 4º ...535( let $para :=021 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, 1º 2º 3º 4º ...537 let $para :=71 let $para :=34) let $para :=71 let $para :=033 1º 2º 3º 4º ...535( let $para :=021 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, 1º 2º 3º 4º ...537 let $para :=71 let $para :=34, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=033Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and implicit timezone. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI, and implicit timezone. RulesThe function returns a sequence of positive integers giving the positions within the sequence let $para :=021 of items that are equal to 1º 2º 3º 4º ...537. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. This collation is used when string comparison is required. The items in the sequence let $para :=021 are compared with 1º 2º 3º 4º ...537 under the rules for the let $para :=33 operator. Values of type let $para :=00 are compared as if they were of type let $para :=10. Values that cannot be compared, because the let $para :=33 operator is not defined for their types, are considered to be distinct. If an item compares equal, then the position of that item in the sequence let $para :=021 is included in the result. The first item in a sequence is at position 1, not position 0. The result sequence is in ascending numeric order. NotesIf the value of let $para :=021 is the empty sequence, or if no item in let $para :=021 matches 1º 2º 3º 4º ...537, then the function returns the empty sequence. No error occurs if non-comparable values are encountered. So when comparing two atomic values, the effective boolean value of 1º 2º 3º 4º ...623 is true if 1º 2º 3º 4º ...624 and 1º 2º 3º 4º ...625 are equal, false if they are not equal or not comparable.Examples The expression 1º 2º 3º 4º ...626 returns let $para :=96. The expression 1º 2º 3º 4º ...628 returns 1º 2º 3º 4º ...629. The expression 1º 2º 3º 4º ...630 returns 1º 2º 3º 4º ...631. The expression 1º 2º 3º 4º ...632 returns let $para :=96. The expression 1º 2º 3º 4º ...634 returns 1º 2º 3º 4º ...635. (The array is atomized to a sequence of five integers). If 1º 2º 3º 4º ...636 is an attribute of type let $para :=42 whose string value is 1º 2º 3º 4º ...638, and whose typed value is therefore op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)180, then 1º 2º 3º 4º ...640 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. This is because the function calling mechanism atomizes the attribute node to produce a sequence of three 1º 2º 3º 4º ...642 values. 14.2.3 fn:deep-equalSummaryThis function assesses whether two sequences are deep-equal to each other. To be deep-equal, they must contain items that are pairwise deep-equal; and for two items to be deep-equal, they must either be atomic values that compare equal, or nodes of the same kind, with the same name, whose children are deep-equal, or maps with matching entries, or arrays with matching members. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)23( 1º 2º 3º 4º ...644 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...647 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)23( 1º 2º 3º 4º ...644 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...647 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, let $para :=128 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and implicit timezone. The three-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI, and implicit timezone. RulesThe let $para :=128 argument identifies a collation which is used at all levels of recursion when strings are compared (but not when names are compared), according to the rules in 5.3.5 Choosing a collation. If the two sequences are both empty, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. If the two sequences are of different lengths, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. If the two sequences are of the same length, the function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if every item in the sequence 1º 2º 3º 4º ...644 is deep-equal to the item at the same position in the sequence 1º 2º 3º 4º ...647. The rules for deciding whether two items are deep-equal follow. Call the two items 1º 2º 3º 4º ...670 and 1º 2º 3º 4º ...671 respectively. If 1º 2º 3º 4º ...670 and 1º 2º 3º 4º ...671 are both atomic values, they are deep-equal if and only if 1º 2º 3º 4º ...674 is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76, or if both values are fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90. If the let $para :=33 operator is not defined for 1º 2º 3º 4º ...670 and 1º 2º 3º 4º ...671, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. If 1º 2º 3º 4º ...670 and 1º 2º 3º 4º ...671 are both ·maps·, the result is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if all the following conditions apply:
If 1º 2º 3º 4º ...670 and 1º 2º 3º 4º ...671 are both ·arrays·, the result is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 if and only if all the following conditions apply:
If 1º 2º 3º 4º ...670 and 1º 2º 3º 4º ...671 are both nodes, they are compared as described below:
In all other cases the result is false. Error ConditionsA type error is raised [err:FOTY0015] if either input sequence contains a function item that is not a map or array. NotesThe two nodes are not required to have the same type annotation, and they are not required to have the same in-scope namespaces. They may also differ in their parent, their base URI, and the values returned by the 1º 2º 3º 4º ...719 and 1º 2º 3º 4º ...720 accessors (see Section 5.5 is-id Accessor DM31 and Section 5.6 is-idrefs Accessor DM31). The order of children is significant, but the order of attributes is insignificant. The contents of comments and processing instructions are significant only if these nodes appear directly as items in the two sequences being compared. The content of a comment or processing instruction that appears as a descendant of an item in one of the sequences being compared does not affect the result. However, the presence of a comment or processing instruction, if it causes a text node to be split into two text nodes, may affect the result. Comparing items of different kind (for example, comparing an atomic value to a node, or a map to an array, or an integer to an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964) returns false, it does not return an error. So the result of 1º 2º 3º 4º ...722 is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. Comparing a function (other than a map or array) to any other value raises a type error. Examplesfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).3 The expression 1º 2º 3º 4º ...724 returns let $para :=184. The expression 1º 2º 3º 4º ...726 returns let $para :=184. The expression 1º 2º 3º 4º ...728 returns let $para :=182. The expression 1º 2º 3º 4º ...730 returns let $para :=184. The expression 1º 2º 3º 4º ...732 returns let $para :=182. The expression 1º 2º 3º 4º ...734 returns let $para :=182. The expression 1º 2º 3º 4º ...736 returns let $para :=184. 14.3 Functions that test the cardinality of sequencesThe following functions test the cardinality of their sequence arguments. FunctionMeaning1º 2º 3º 4º ...738Returns let $para :=25 if it contains zero or one items. Otherwise, raises an error. 1º 2º 3º 4º ...740Returns let $para :=25 if it contains one or more items. Otherwise, raises an error. 1º 2º 3º 4º ...742Returns let $para :=25 if it contains exactly one item. Otherwise, raises an error. The functions 1º 2º 3º 4º ...738, 1º 2º 3º 4º ...740, and 1º 2º 3º 4º ...742 defined in this section, check that the cardinality of a sequence is in the expected range. They are particularly useful with regard to static typing. For example, the function call 1º 2º 3º 4º ...747 requires the result of the call on 1º 2º 3º 4º ...535 to be a singleton integer, but the static type system cannot infer this; writing the expression as 1º 2º 3º 4º ...749 will provide a suitable static type at query analysis time, and ensures that the length of the sequence is correct with a dynamic check at query execution time. The type signatures for these functions deliberately declare the argument type as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, permitting a sequence of any length. A more restrictive signature would defeat the purpose of the function, which is to defer cardinality checking until query execution time. 14.3.1 fn:zero-or-oneSummaryReturns let $para :=25 if it contains zero or one items. Otherwise, raises an error.Signature 1º 2º 3º 4º ...738( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 let $para :=79Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesExcept in error cases, the function returns let $para :=25 unchanged.Error Conditions A dynamic error is raised [err:FORG0003] if let $para :=25 contains more than one item. 14.3.2 fn:one-or-moreSummaryReturns let $para :=25 if it contains one or more items. Otherwise, raises an error.Signature 1º 2º 3º 4º ...740( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 1º 2º 3º 4º ...766Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesExcept in error cases, the function returns let $para :=25 unchanged.Error Conditions A dynamic error is raised [err:FORG0004] if let $para :=25 is an empty sequence. 14.3.3 fn:exactly-oneSummaryReturns let $para :=25 if it contains exactly one item. Otherwise, raises an error.Signature 1º 2º 3º 4º ...742( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 1º 2º 3º 4º ...775Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesExcept in error cases, the function returns let $para :=25 unchanged.Error Conditions A dynamic error is raised [err:FORG0005] if let $para :=25 is an empty sequence or a sequence containing more than one item. 14.4 Aggregate functionsAggregate functions take a sequence as argument and return a single value computed from values in the sequence. Except for 1º 2º 3º 4º ...778, the sequence must consist of values of a single type or one if its subtypes, or they must be numeric. let $para :=00 values are permitted in the input sequence and handled by special conversion rules. The type of the items in the sequence must also support certain operations.FunctionMeaning 1º 2º 3º 4º ...778Returns the number of items in a sequence. 1º 2º 3º 4º ...781Returns the average of the values in the input sequence let $para :=25, that is, the sum of the values divided by the number of values. let $para :=069Returns a value that is equal to the highest value appearing in the input sequence. 1º 2º 3º 4º ...784Returns a value that is equal to the lowest value appearing in the input sequence. 1º 2º 3º 4º ...785Returns a value obtained by adding together the values in let $para :=25. 14.4.1 fn:countSummaryReturns the number of items in a sequence. Signature1º 2º 3º 4º ...778( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 let $para :=85Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the number of items in the value of let $para :=25.Notes Returns 0 if let $para :=25 is the empty sequence.Examples fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).4 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).5 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).6 The expression 1º 2º 3º 4º ...795 returns let $para :=226. The expression 1º 2º 3º 4º ...797 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression 1º 2º 3º 4º ...799 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression 1º 2º 3º 4º ...801 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression 1º 2º 3º 4º ...803 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The expression 1º 2º 3º 4º ...805 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 14.4.2 fn:avgSummaryReturns the average of the values in the input sequence let $para :=25, that is, the sum of the values divided by the number of values.Signature 1º 2º 3º 4º ...781( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 let $para :=196Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf let $para :=25 is the empty sequence, the empty sequence is returned. If let $para :=25 contains values of type let $para :=00 they are cast to let $para :=26. Duration values must either all be let $para :=24 values or must all be let $para :=25 values. For numeric values, the numeric promotion rules defined in 4.2 Arithmetic operators on numeric values are used to promote all values to a single common type. After these operations, let $para :=25 must satisfy the following condition: There must be a type T such that:
The function returns the average of the values as 1º 2º 3º 4º ...827; but the implementation may use an otherwise equivalent algorithm that avoids arithmetic overflow.Error Conditions A type error is raised [err:FORG0006] if the input sequence contains items of incompatible types, as described above. Examplesfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).7 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).8 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).9 The expression 1º 2º 3º 4º ...828 returns 1º 2º 3º 4º ...829. (The result is of type let $para :=82.) The expression 1º 2º 3º 4º ...831 returns 1º 2º 3º 4º ...832. 1º 2º 3º 4º ...833 raises a type error [err:FORG0006]. The expression 1º 2º 3º 4º ...834 returns let $para :=96. The expression 1º 2º 3º 4º ...836 returns 1º 2º 3º 4º ...837. The expression 1º 2º 3º 4º ...838 returns 1º 2º 3º 4º ...837. 14.4.3 fn:maxSummaryReturns a value that is equal to the highest value appearing in the input sequence. Signatureslet $para :=069( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 let $para :=196 let $para :=069( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=196Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and implicit timezone. The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI, and implicit timezone. RulesThe following conversions are applied to the input sequence let $para :=25, in order:
The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. The function returns an item from the converted sequence rather than the input sequence. If the converted sequence is empty, the function returns the empty sequence. All items in the converted sequence must be derived from a single base type for which the 1º 2º 3º 4º ...871 operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Duration values must either all be let $para :=24 values or must all be let $para :=25 values. If the converted sequence contains the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned (as an let $para :=83 or let $para :=26 as appropriate). If the items in the converted sequence are of type let $para :=10 or types derived by restriction from let $para :=10, then the determination of the item with the smallest value is made according to the collation that is used. If the type of the items in the converted sequence is not let $para :=10 and let $para :=128 is specified, the collation is ignored. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns the result of the expression: 1º 2º 3º 4º ...0 evaluated with let $para :=128 as the default collation if specified, and with 1º 2º 3º 4º ...883 as the converted sequence.Error Conditions A type error is raised [err:FORG0006] if the input sequence contains items of incompatible types, as described above. NotesBecause the rules allow the sequence to be reordered, if there are two or more items that are "equal highest", the specific item whose value is returned is ·implementation-dependent·. This can arise for example if two different strings compare equal under the selected collation, or if two different let $para :=29 values compare equal despite being in different timezones. If the converted sequence contains exactly one value then that value is returned. The default type when the let $para :=069 function is applied to let $para :=00 values is let $para :=26. This differs from the default type for operators such as 1º 2º 3º 4º ...888, and for sorting in XQuery and XSLT, which is let $para :=10. The rules for the dynamic type of the result are stricter in version 3.1 of the specification than in earlier versions. For example, if all the values in the input sequence belong to types derived from let $para :=85, version 3.0 required only that the result be an instance of the least common supertype of the types present in the input sequence; Version 3.1 requires that the returned value retains its original type. This does not apply, however, where type promotion is needed to convert all the values to a common primitive type.Examples The expression 1º 2º 3º 4º ...891 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. The expression 1º 2º 3º 4º ...893 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. (Arrays are atomized). The expression 1º 2º 3º 4º ...895 returns 1º 2º 3º 4º ...896. 1º 2º 3º 4º ...897 raises a type error [err:FORG0006]. The expression 1º 2º 3º 4º ...898 returns 1º 2º 3º 4º ...899. (Assuming that the current date is during the 21st century.) The expression 1º 2º 3º 4º ...900 returns 1º 2º 3º 4º ...901. (Assuming a typical default collation.) 14.4.4 fn:minSummaryReturns a value that is equal to the lowest value appearing in the input sequence. Signatures1º 2º 3º 4º ...784( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 let $para :=196 1º 2º 3º 4º ...784( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, let $para :=128 let $para :=71 let $para :=10) let $para :=71 let $para :=196Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and implicit timezone. The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations, and static base URI, and implicit timezone. RulesThe following rules are applied to the input sequence:
The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. The function returns an item from the converted sequence rather than the input sequence. If the converted sequence is empty, the empty sequence is returned. All items in the converted sequence must be derived from a single base type for which the 1º 2º 3º 4º ...871 operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Duration values must either all be let $para :=24 values or must all be let $para :=25 values. If the converted sequence contains the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned (as an let $para :=83 or let $para :=26 as appropriate). If the items in the converted sequence are of type let $para :=10 or types derived by restriction from let $para :=10, then the determination of the item with the smallest value is made according to the collation that is used. If the type of the items in the converted sequence is not let $para :=10 and let $para :=128 is specified, the collation is ignored. The collation used by this function is determined according to the rules in 5.3.5 Choosing a collation. The function returns the result of the expression: 1º 2º 3º 4º ...1 evaluated with let $para :=128 as the default collation if specified, and with 1º 2º 3º 4º ...883 as the converted sequence.Error Conditions A type error is raised [err:FORG0006] if the input sequence contains items of incompatible types, as described above. NotesBecause the rules allow the sequence to be reordered, if there are two or items that are "equal lowest", the specific item whose value is returned is ·implementation-dependent·. This can arise for example if two different strings compare equal under the selected collation, or if two different let $para :=29 values compare equal despite being in different timezones. If the converted sequence contains exactly one value then that value is returned. The default type when the 1º 2º 3º 4º ...784 function is applied to let $para :=00 values is let $para :=26. This differs from the default type for operators such as 1º 2º 3º 4º ...949, and for sorting in XQuery and XSLT, which is let $para :=10. The rules for the dynamic type of the result are stricter in version 3.1 of the specification than in earlier versions. For example, if all the values in the input sequence belong to types derived from let $para :=85, version 3.0 required only that the result be an instance of the least common supertype of the types present in the input sequence; Version 3.1 requires that the returned value retains its original type. This does not apply, however, where type promotion is needed to convert all the values to a common primitive type.Examples The expression 1º 2º 3º 4º ...952 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression 1º 2º 3º 4º ...954 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. (Arrays are atomized). The expression 1º 2º 3º 4º ...956 returns 1º 2º 3º 4º ...896. 1º 2º 3º 4º ...958 raises a type error [err:FORG0006]. 1º 2º 3º 4º ...959 can return either positive or negative zero. The two items are equal, so it is ·implementation-dependent· which is returned. The expression 1º 2º 3º 4º ...960 returns 1º 2º 3º 4º ...961. (Assuming that the current date is set to a reasonable value.) The expression 1º 2º 3º 4º ...962 returns 1º 2º 3º 4º ...370. (Assuming a typical default collation.) 14.4.5 fn:sumSummaryReturns a value obtained by adding together the values in let $para :=25.Signatures 1º 2º 3º 4º ...785( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 let $para :=34 1º 2º 3º 4º ...785( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12, 1º 2º 3º 4º ...975 let $para :=71 let $para :=196) let $para :=71 let $para :=196Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesAny values of type let $para :=00 in let $para :=25 are cast to let $para :=26. The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. If the converted sequence is empty, then the single-argument form of the function returns the let $para :=85 value declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19; the two-argument form returns the value of the argument 1º 2º 3º 4º ...975. If the converted sequence contains the value fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).90 is returned. All items in let $para :=25 must be numeric or derived from a single base type. In addition, the type must support addition. Duration values must either all be let $para :=24 values or must all be let $para :=25 values. For numeric values, the numeric promotion rules defined in 4.2 Arithmetic operators on numeric values are used to promote all values to a single common type. The sum of a sequence of integers will therefore be an integer, while the sum of a numeric sequence that includes at least one let $para :=26 will be an let $para :=26. The result of the function, using the second signature, is the result of the expression: 1º 2º 3º 4º ...2 where 1º 2º 3º 4º ...883 is the converted sequence. The result of the function, using the first signature, is the result of the expression: 1º 2º 3º 4º ...994.Error Conditions A type error is raised [err:FORG0006] if the input sequence contains items of incompatible types, as described above. NotesThe second argument allows an appropriate value to be defined to represent the sum of an empty sequence. For example, when summing a sequence of durations it would be appropriate to return a zero-length duration of the appropriate type. This argument is necessary because a system that does dynamic typing cannot distinguish "an empty sequence of integers", for example, from "an empty sequence of durations". If the converted sequence contains exactly one value then that value is returned. Examplesfn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).7 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).8 1º 2º 3º 4º ...5 fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).9 The expression 1º 2º 3º 4º ...995 returns 1º 2º 3º 4º ...996. The expression 1º 2º 3º 4º ...997 returns 1º 2º 3º 4º ...998. The expression 1º 2º 3º 4º ...999 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)700. The expression Primo Secondo Terzo Quarto Quinto ...001 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression Primo Secondo Terzo Quarto Quinto ...003 returns let $para :=96. The expression Primo Secondo Terzo Quarto Quinto ...005 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. Primo Secondo Terzo Quarto Quinto ...007 raises a type error [err:FORG0006]. The expression Primo Secondo Terzo Quarto Quinto ...008 returns 1º 2º 3º 4º ...996. (There is no requirement that the 1º 2º 3º 4º ...975 value should be the same type as the items in let $para :=25, or even that it should belong to a type that supports addition.) The expression Primo Secondo Terzo Quarto Quinto ...012 returns Primo Secondo Terzo Quarto Quinto ...013. (Atomizing an array returns the sequence obtained by atomizing its members.) The expression Primo Secondo Terzo Quarto Quinto ...014 returns let $para :=054. (Atomizing an array returns the sequence obtained by atomizing its members.) 14.5 Functions on node identifiersThis section defines a number of functions used to find elements by Primo Secondo Terzo Quarto Quinto ...016 or Primo Secondo Terzo Quarto Quinto ...017 value, or to generate IDs.FunctionMeaning Primo Secondo Terzo Quarto Quinto ...018Returns the sequence of element nodes that have an Primo Secondo Terzo Quarto Quinto ...016 value matching the value of one or more of the Primo Secondo Terzo Quarto Quinto ...017 values supplied in let $para :=25. Primo Secondo Terzo Quarto Quinto ...022Returns the sequence of element nodes that have an Primo Secondo Terzo Quarto Quinto ...016 value matching the value of one or more of the Primo Secondo Terzo Quarto Quinto ...017 values supplied in let $para :=25. Primo Secondo Terzo Quarto Quinto ...026Returns the sequence of element or attribute nodes with an Primo Secondo Terzo Quarto Quinto ...017 value matching the value of one or more of the Primo Secondo Terzo Quarto Quinto ...016 values supplied in let $para :=25. Primo Secondo Terzo Quarto Quinto ...030This function returns a string that uniquely identifies a given node. 14.5.1 fn:idSummaryReturns the sequence of element nodes that have an Primo Secondo Terzo Quarto Quinto ...016 value matching the value of one or more of the Primo Secondo Terzo Quarto Quinto ...017 values supplied in let $para :=25.Signatures Primo Secondo Terzo Quarto Quinto ...018( let $para :=25 let $para :=71 let $para :=234) let $para :=71 Primo Secondo Terzo Quarto Quinto ...039 Primo Secondo Terzo Quarto Quinto ...018( let $para :=25 let $para :=71 let $para :=234, 1º 2º 3º 4º ...058 let $para :=71 1º 2º 3º 4º ...147) let $para :=71 Primo Secondo Terzo Quarto Quinto ...039Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns a sequence, in document order with duplicates eliminated, containing every element node fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).547 that satisfies all the following conditions:
A dynamic error is raised [err:FODC0001] if 1º 2º 3º 4º ...058, or the context item if the second argument is absent, is a node in a tree whose root is not a document node. The following errors may be raised when 1º 2º 3º 4º ...058 is omitted:
The effect of this function is anomalous in respect of element nodes with the 1º 2º 3º 4º ...719 property. For legacy reasons, this function returns the element that has the 1º 2º 3º 4º ...719 property, whereas it would be more appropriate to return its parent, that being the element that is uniquely identified by the ID. A new function Primo Secondo Terzo Quarto Quinto ...022 has been introduced with the desired behavior. If the data model is constructed from an Infoset, an attribute will have the 1º 2º 3º 4º ...719 property if the corresponding attribute in the Infoset had an attribute type of Primo Secondo Terzo Quarto Quinto ...016: typically this means the attribute was declared as an Primo Secondo Terzo Quarto Quinto ...016 in a DTD. If the data model is constructed from a PSVI, an element or attribute will have the 1º 2º 3º 4º ...719 property if its typed value is a single atomic value of type Primo Secondo Terzo Quarto Quinto ...089 or a type derived by restriction from Primo Secondo Terzo Quarto Quinto ...089. No error is raised in respect of a candidate Primo Secondo Terzo Quarto Quinto ...017 value that does not match the Primo Secondo Terzo Quarto Quinto ...016 of any element in the document. If no candidate Primo Secondo Terzo Quarto Quinto ...017 value matches the Primo Secondo Terzo Quarto Quinto ...016 value of any element, the function returns the empty sequence. It is not necessary that the supplied argument should have type Primo Secondo Terzo Quarto Quinto ...095 or let $para :=41, or that it should be derived from a node with the 1º 2º 3º 4º ...720 property. An element may have more than one Primo Secondo Terzo Quarto Quinto ...016 value. This can occur with synthetic data models or with data models constructed from a PSVI where the element and one of its attributes are both typed as Primo Secondo Terzo Quarto Quinto ...089. If the source document is well-formed but not valid, it is possible for two or more elements to have the same Primo Secondo Terzo Quarto Quinto ...016 value. In this situation, the function will select the first such element. It is also possible in a well-formed but invalid document to have an element or attribute that has the 1º 2º 3º 4º ...719 property but whose value does not conform to the lexical rules for the Primo Secondo Terzo Quarto Quinto ...089 type. Such a node will never be selected by this function.Examples 1º 2º 3º 4º ...8 The expression Primo Secondo Terzo Quarto Quinto ...103 returns Primo Secondo Terzo Quarto Quinto ...104. (The Primo Secondo Terzo Quarto Quinto ...105 attribute has the 1º 2º 3º 4º ...719 property, so the employee element is selected.) The expression Primo Secondo Terzo Quarto Quinto ...107 returns Primo Secondo Terzo Quarto Quinto ...108. (Assuming the Primo Secondo Terzo Quarto Quinto ...109 element is given the type Primo Secondo Terzo Quarto Quinto ...089 as a result of schema validation, the element will have the 1º 2º 3º 4º ...719 property and is therefore selected. Note the difference from the behavior of Primo Secondo Terzo Quarto Quinto ...022.) 14.5.2 fn:element-with-idSummaryReturns the sequence of element nodes that have an Primo Secondo Terzo Quarto Quinto ...016 value matching the value of one or more of the Primo Secondo Terzo Quarto Quinto ...017 values supplied in let $para :=25.Signatures Primo Secondo Terzo Quarto Quinto ...022( let $para :=25 let $para :=71 let $para :=234) let $para :=71 Primo Secondo Terzo Quarto Quinto ...039 Primo Secondo Terzo Quarto Quinto ...022( let $para :=25 let $para :=71 let $para :=234, 1º 2º 3º 4º ...058 let $para :=71 1º 2º 3º 4º ...147) let $para :=71 Primo Secondo Terzo Quarto Quinto ...039Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesNote: The effect of this function is identical to Primo Secondo Terzo Quarto Quinto ...018 in respect of elements that have an attribute with the 1º 2º 3º 4º ...719 property. However, it behaves differently in respect of element nodes with the 1º 2º 3º 4º ...719 property. Whereas the Primo Secondo Terzo Quarto Quinto ...018 function, for legacy reasons, returns the element that has the 1º 2º 3º 4º ...719 property, this function returns the element identified by the ID, which is the parent of the element having the 1º 2º 3º 4º ...719 property. The function returns a sequence, in document order with duplicates eliminated, containing every element node fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).547 that satisfies all the following conditions:
A dynamic error is raised [err:FODC0001] if 1º 2º 3º 4º ...058, or the context item if the second argument is omitted, is a node in a tree whose root is not a document node. The following errors may be raised when 1º 2º 3º 4º ...058 is omitted:
This function is equivalent to the Primo Secondo Terzo Quarto Quinto ...018 function except when dealing with ID-valued element nodes. Whereas the Primo Secondo Terzo Quarto Quinto ...018 function selects the element containing the identifier, this function selects its parent. If the data model is constructed from an Infoset, an attribute will have the 1º 2º 3º 4º ...719 property if the corresponding attribute in the Infoset had an attribute type of Primo Secondo Terzo Quarto Quinto ...016: typically this means the attribute was declared as an Primo Secondo Terzo Quarto Quinto ...016 in a DTD. If the data model is constructed from a PSVI, an element or attribute will have the 1º 2º 3º 4º ...719 property if its typed value is a single atomic value of type Primo Secondo Terzo Quarto Quinto ...089 or a type derived by restriction from Primo Secondo Terzo Quarto Quinto ...089. No error is raised in respect of a candidate Primo Secondo Terzo Quarto Quinto ...017 value that does not match the Primo Secondo Terzo Quarto Quinto ...016 of any element in the document. If no candidate Primo Secondo Terzo Quarto Quinto ...017 value matches the Primo Secondo Terzo Quarto Quinto ...016 value of any element, the function returns the empty sequence. It is not necessary that the supplied argument should have type Primo Secondo Terzo Quarto Quinto ...095 or let $para :=41, or that it should be derived from a node with the 1º 2º 3º 4º ...720 property. An element may have more than one Primo Secondo Terzo Quarto Quinto ...016 value. This can occur with synthetic data models or with data models constructed from a PSVI where the element and one of its attributes are both typed as Primo Secondo Terzo Quarto Quinto ...089. If the source document is well-formed but not valid, it is possible for two or more elements to have the same Primo Secondo Terzo Quarto Quinto ...016 value. In this situation, the function will select the first such element. It is also possible in a well-formed but invalid document to have an element or attribute that has the 1º 2º 3º 4º ...719 property but whose value does not conform to the lexical rules for the Primo Secondo Terzo Quarto Quinto ...089 type. Such a node will never be selected by this function.Examples Primo Secondo Terzo Quarto Quinto ...0 The expression Primo Secondo Terzo Quarto Quinto ...190 returns Primo Secondo Terzo Quarto Quinto ...104. (The Primo Secondo Terzo Quarto Quinto ...105 attribute has the 1º 2º 3º 4º ...719 property, so the employee element is selected.) The expression Primo Secondo Terzo Quarto Quinto ...194 returns Primo Secondo Terzo Quarto Quinto ...104. (Assuming the Primo Secondo Terzo Quarto Quinto ...109 element is given the type Primo Secondo Terzo Quarto Quinto ...089 as a result of schema validation, the element will have the 1º 2º 3º 4º ...719 property and is therefore its parent is selected. Note the difference from the behavior of Primo Secondo Terzo Quarto Quinto ...018.) 14.5.3 fn:idrefSummaryReturns the sequence of element or attribute nodes with an Primo Secondo Terzo Quarto Quinto ...017 value matching the value of one or more of the Primo Secondo Terzo Quarto Quinto ...016 values supplied in let $para :=25.Signatures Primo Secondo Terzo Quarto Quinto ...026( let $para :=25 let $para :=71 let $para :=234) let $para :=71 1º 2º 3º 4º ...272 Primo Secondo Terzo Quarto Quinto ...026( let $para :=25 let $para :=71 let $para :=234, 1º 2º 3º 4º ...058 let $para :=71 1º 2º 3º 4º ...147) let $para :=71 1º 2º 3º 4º ...272Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The two-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns a sequence, in document order with duplicates eliminated, containing every element or attribute node Primo Secondo Terzo Quarto Quinto ...98 that satisfies all the following conditions:
A dynamic error is raised [err:FODC0001] if 1º 2º 3º 4º ...058, or the context item if the second argument is omitted, is a node in a tree whose root is not a document node. The following errors may be raised when 1º 2º 3º 4º ...058 is omitted:
An element or attribute typically acquires the 1º 2º 3º 4º ...720 property by being validated against the schema type Primo Secondo Terzo Quarto Quinto ...095 or let $para :=41, or (for attributes only) by being described as of type Primo Secondo Terzo Quarto Quinto ...017 or Primo Secondo Terzo Quarto Quinto ...070 in a DTD. Because the function is sensitive to the way in which the data model is constructed, calls on this function are not always interoperable. No error is raised in respect of a candidate Primo Secondo Terzo Quarto Quinto ...016 value that does not match the Primo Secondo Terzo Quarto Quinto ...017 value of any element or attribute in the document. If no candidate Primo Secondo Terzo Quarto Quinto ...016 value matches the Primo Secondo Terzo Quarto Quinto ...017 value of any element or attribute, the function returns the empty sequence. It is possible for two or more nodes to have an Primo Secondo Terzo Quarto Quinto ...017 value that matches a given candidate Primo Secondo Terzo Quarto Quinto ...016 value. In this situation, the function will return all such nodes. However, each matching node will be returned at most once, regardless how many candidate Primo Secondo Terzo Quarto Quinto ...016 values it matches. It is possible in a well-formed but invalid document to have a node whose 1º 2º 3º 4º ...720 property is true but that does not conform to the lexical rules for the Primo Secondo Terzo Quarto Quinto ...095 type. The effect of the above rules is that ill-formed candidate Primo Secondo Terzo Quarto Quinto ...016 values and ill-formed Primo Secondo Terzo Quarto Quinto ...017 values are ignored. If the data model is constructed from a PSVI, the typed value of a node that has the 1º 2º 3º 4º ...720 property will contain at least one atomic value of type Primo Secondo Terzo Quarto Quinto ...095 (or a type derived by restriction from Primo Secondo Terzo Quarto Quinto ...095). It may also contain atomic values of other types. These atomic values are treated as candidate Primo Secondo Terzo Quarto Quinto ...016 values if two conditions are met: their lexical form must be valid as an let $para :=35, and there must be at least one instance of Primo Secondo Terzo Quarto Quinto ...095 in the typed value of the node. If these conditions are not satisfied, such values are ignored.Examples Primo Secondo Terzo Quarto Quinto ...3 The expression Primo Secondo Terzo Quarto Quinto ...269 returns Primo Secondo Terzo Quarto Quinto ...270. (Assuming that Primo Secondo Terzo Quarto Quinto ...271 has the is-idref property, the call on Primo Secondo Terzo Quarto Quinto ...026 selects the Primo Secondo Terzo Quarto Quinto ...271 element. If, instead, the Primo Secondo Terzo Quarto Quinto ...271 had a Primo Secondo Terzo Quarto Quinto ...275 attribute with the is-idref property, the call on Primo Secondo Terzo Quarto Quinto ...026 would select the attribute node.) The expression Primo Secondo Terzo Quarto Quinto ...277 returns Primo Secondo Terzo Quarto Quinto ...278. (Assuming that Primo Secondo Terzo Quarto Quinto ...279 has the is-idref property, the call on Primo Secondo Terzo Quarto Quinto ...026 selects the Primo Secondo Terzo Quarto Quinto ...281 element.) 14.5.4 fn:generate-idSummaryThis function returns a string that uniquely identifies a given node. SignaturesPrimo Secondo Terzo Quarto Quinto ...030() let $para :=71 let $para :=10 Primo Secondo Terzo Quarto Quinto ...030( let $para :=25 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 let $para :=10Properties The zero-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf the argument is omitted, it defaults to the context item ( let $para :=19). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. If the argument is the empty sequence, the result is the zero-length string. In other cases, the function returns a string that uniquely identifies a given node. More formally, it is guaranteed that within a single ·execution scope·, The returned identifier must consist of ASCII alphanumeric characters and must start with an alphabetic character. Thus, the string is syntactically an XML name. Error ConditionsThe following errors may be raised when let $para :=25 is omitted:
An implementation is free to generate an identifier in any convenient way provided that it always generates the same identifier for the same node and that different identifiers are always generated from different nodes. An implementation is under no obligation to generate the same identifiers each time a document is transformed or queried. There is no guarantee that a generated unique identifier will be distinct from any unique IDs specified in the source document. There is no inverse to this function; it is not directly possible to find the node with a given generated ID. Of course, it is possible to search a given sequence of nodes using an expression such as Primo Secondo Terzo Quarto Quinto ...295. It is advisable, but not required, for implementations to generate IDs that are distinct even when compared using a case-blind collation. ExamplesThe primary use case for this function is to generate hyperlinks. For example, when generating HTML, an anchor for a given section Primo Secondo Terzo Quarto Quinto ...296 can be generated by writing (in either XSLT or XQuery): Primo Secondo Terzo Quarto Quinto ...297 and a link to that section can then be produced with code such as: Primo Secondo Terzo Quarto Quinto ...298 Note that anchors generated in this way will not necessarily be the same each time a document is republished. Since the keys in a map must be atomic values, it is possible to use generated IDs as surrogates for nodes when constructing a map. For example, in some implementations, testing whether a node Primo Secondo Terzo Quarto Quinto ...98 is a member of a large node-set Primo Secondo Terzo Quarto Quinto ...300 using the expression Primo Secondo Terzo Quarto Quinto ...301 may be expensive; there may then be performance benefits in creating a map: Primo Secondo Terzo Quarto Quinto ...302 and then testing for membership of the node-set using: Primo Secondo Terzo Quarto Quinto ...303 14.6 Functions giving access to external informationThe functions in this section provide access to resources (such as files) in the external environment. FunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09Retrieves a document using a URI supplied as an let $para :=10, and returns the corresponding document node. Primo Secondo Terzo Quarto Quinto ...306The function returns true if and only if the function call Primo Secondo Terzo Quarto Quinto ...307 would return a document node. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10Returns a sequence of items identified by a collection URI; or a default collection if no URI is supplied. Primo Secondo Terzo Quarto Quinto ...309Returns a sequence of let $para :=30 values representing the URIs in a URI collection. Primo Secondo Terzo Quarto Quinto ...311The Primo Secondo Terzo Quarto Quinto ...311 function reads an external resource (for example, a file) and returns a string representation of the resource. Primo Secondo Terzo Quarto Quinto ...313The Primo Secondo Terzo Quarto Quinto ...313 function reads an external resource (for example, a file) and returns its contents as a sequence of strings, one for each line of text in the string representation of the resource. Primo Secondo Terzo Quarto Quinto ...315Because errors in evaluating the Primo Secondo Terzo Quarto Quinto ...311 function are non-recoverable, these two functions are provided to allow an application to determine whether a call with particular arguments would succeed. Primo Secondo Terzo Quarto Quinto ...317Returns the value of a system environment variable, if it exists. Primo Secondo Terzo Quarto Quinto ...318Returns a list of environment variable names that are suitable for passing to Primo Secondo Terzo Quarto Quinto ...317, as a (possibly empty) sequence of strings. 14.6.1 fn:docSummaryRetrieves a document using a URI supplied as an let $para :=10, and returns the corresponding document node.Signature op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 let $para :=71 let $para :=244) let $para :=71 Primo Secondo Terzo Quarto Quinto ...326Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on available documents, and static base URI. RulesIf op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 is the empty sequence, the result is an empty sequence. If op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 is a relative URI reference, it is resolved relative to the value of the static base URI property from the static context. The resulting absolute URI is promoted to an let $para :=10. If the available documents described in Section 2.1.2 Dynamic Context XP31 provides a mapping from this string to a document node, the function returns that document node. The URI may include a fragment identifier. By default, this function is ·deterministic·. Two calls on this function return the same document node if the same URI Reference (after resolution to an absolute URI Reference) is supplied to both calls. Thus, the following expression (if it does not raise an error) will always be true: Primo Secondo Terzo Quarto Quinto ...4 However, for performance reasons, implementations may provide a user option to evaluate the function without a guarantee of determinism. The manner in which any such option is provided is implementation-defined. If the user has not selected such an option, a call of the function must either return a deterministic result or must raise a dynamic error [err:FODC0003]. Note: If op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 is read from a source document, it is generally appropriate to resolve it relative to the base URI property of the relevant node in the source document. This can be achieved by calling the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)258 function, and passing the resulting absolute URI as an argument to the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 function. If two calls to this function supply different absolute URI References as arguments, the same document node may be returned if the implementation can determine that the two arguments refer to the same resource. By defining the semantics of this function in terms of a string-to-document-node mapping in the dynamic context, the specification is acknowledging that the results of this function are outside the purview of the language specification itself, and depend entirely on the run-time environment in which the expression is evaluated. This run-time environment includes not only an unpredictable collection of resources ("the web"), but configurable machinery for locating resources and turning their contents into document nodes within the XPath data model. Both the set of resources that are reachable, and the mechanisms by which those resources are parsed and validated, are ·implementation-dependent·. One possible processing model for this function is as follows. The resource identified by the URI Reference is retrieved. If the resource cannot be retrieved, a dynamic error is raised [err:FODC0002]. The data resulting from the retrieval action is then parsed as an XML document and a tree is constructed in accordance with the [XQuery and XPath Data Model (XDM) 3.0]. If the top-level media type is known and is "text", the content is parsed in the same way as if the media type were text/xml; otherwise, it is parsed in the same way as if the media type were application/xml. If the contents cannot be parsed successfully, a dynamic error is raised [err:FODC0002]. Otherwise, the result of the function is the document node at the root of the resulting tree. This tree is then optionally validated against a schema. Various aspects of this processing are ·implementation-defined·. Implementations may provide external configuration options that allow any aspect of the processing to be controlled by the user. In particular:
A dynamic error may be raised [err:FODC0005] if op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 is not a valid URI reference. A dynamic error is raised [err:FODC0002] if a relative URI reference is supplied, and the base-URI property in the static context is absent. A dynamic error is raised [err:FODC0002] if the available documents provides no mapping for the absolutized URI. A dynamic error is raised [err:FODC0002] if the resource cannot be retrieved or cannot be parsed successfully as XML. A dynamic error is raised [err:FODC0003] if the implementation is not able to guarantee that the result of the function will be deterministic, and the user has not indicated that an unstable result is acceptable. 14.6.2 fn:doc-availableSummaryThe function returns true if and only if the function call Primo Secondo Terzo Quarto Quinto ...307 would return a document node.Signature Primo Secondo Terzo Quarto Quinto ...306( op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on available documents, and static base URI. RulesIf op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)324 is an empty sequence, this function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. If a call on Primo Secondo Terzo Quarto Quinto ...307 would return a document node, this function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. In all other cases this function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. This includes the case where an invalid URI is supplied, and also the case where a valid relative URI reference is supplied, and cannot be resolved, for example because the static base URI is absent. If this function returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76, then calling Primo Secondo Terzo Quarto Quinto ...307 within the same ·execution scope· must return a document node. However, if nondeterministic processing has been selected for the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 function, this guarantee is lost. 14.6.3 fn:collectionSummaryReturns a sequence of items identified by a collection URI; or a default collection if no URI is supplied. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10() let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10( let $para :=25 let $para :=71 let $para :=244) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on available collections, and static base URI. RulesThis function takes an let $para :=10 as argument and returns a sequence of items obtained by interpreting let $para :=25 as an let $para :=30 and resolving it according to the mapping specified in available collections described in Section C.2 Dynamic Context Components XP31. If available collections provides a mapping from this string to a sequence of items, the function returns that sequence. If available collections maps the string to an empty sequence, then the function returns an empty sequence. If let $para :=25 is not specified, the function returns the sequence of items in the default collection in the dynamic context. See Section C.2 Dynamic Context Components XP31. If the value of let $para :=25 is a relative let $para :=30, it is resolved against the value of the base-URI property from the static context. If let $para :=25 is the empty sequence, the function behaves as if it had been called without an argument. See above. By default, this function is ·deterministic·. This means that repeated calls on the function with the same argument will return the same result. However, for performance reasons, implementations may provide a user option to evaluate the function without a guarantee of determinism. The manner in which any such option is provided is ·implementation-defined·. If the user has not selected such an option, a call to this function must either return a deterministic result or must raise a dynamic error [err:FODC0003]. There is no requirement that any nodes in the result should be in document order, nor is there a requirement that the result should contain no duplicates. Error ConditionsA dynamic error is raised [err:FODC0002] if no URI is supplied and the value of the default collection is absentDM31. A dynamic error is raised [err:FODC0002] if a relative URI reference is supplied, and the base-URI property in the static context is absent. A dynamic error is raised [err:FODC0002] if available node collections provides no mapping for the absolutized URI. A dynamic error may be raised [err:FODC0004] if let $para :=25 is not a valid let $para :=30.Notes In earlier releases, the primary use for the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10 function was to retrieve a collection of XML documents, perhaps held as lexical XML in operating system filestore, or perhaps held in an XML database. In this release the concept has been generalised to allow other resources to be retrieved: for example JSON documents might be returned as arrays or maps, non-XML text files might be returned as strings, and binary files might be returned as instances of let $para :=196. The abstract concept of a collection might be realized in different ways by different implementations, and the ways in which URIs map to collections can be equally variable. Specifying resources using URIs is useful because URIs are dynamic, can be parameterized, and do not rely on an external environment. 14.6.4 fn:uri-collectionSummaryReturns a sequence of let $para :=30 values representing the URIs in a URI collection.Signatures Primo Secondo Terzo Quarto Quinto ...309() let $para :=71 Primo Secondo Terzo Quarto Quinto ...372 Primo Secondo Terzo Quarto Quinto ...309( let $para :=25 let $para :=71 let $para :=244) let $para :=71 Primo Secondo Terzo Quarto Quinto ...372Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on available URI collections, and static base URI. RulesThe zero-argument form of the function returns the URIs in the default URI collection described in Section C.2 Dynamic Context Components XP31. If the value of let $para :=25 is a relative let $para :=30, it is resolved against the value of the base-URI property from the static context. If let $para :=25 is the empty sequence, the function behaves as if it had been called without an argument. See above. The single-argument form of the function returns the sequence of URIs corresponding to the supplied URI in the available URI collections described in Section C.2 Dynamic Context Components XP31. By default, this function is ·deterministic·. This means that repeated calls on the function with the same argument will return the same result. However, for performance reasons, implementations may provide a user option to evaluate the function without a guarantee of determinism. The manner in which any such option is provided is ·implementation-defined·. If the user has not selected such an option, a call to this function must either return a deterministic result or must raise a dynamic error [err:FODC0003]. There is no requirement that the URIs returned by this function should all be distinct, and no assumptions can be made about the order of URIs in the sequence, unless the implementation defines otherwise. Error ConditionsA dynamic error is raised [err:FODC0002] if no URI is supplied (that is, if the function is called with no arguments, or with a single argument that evaluates to an empty sequence), and the value of the default resource collection is absentDM31. A dynamic error is raised [err:FODC0002] if a relative URI reference is supplied, and the base-URI property in the static context is absent. A dynamic error is raised [err:FODC0002] if available resource collections provides no mapping for the absolutized URI. A dynamic error may be raised [err:FODC0004] if let $para :=25 is not a valid let $para :=30.Notes In some implementations, there might be a close relationship between collections (as retrieved by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10 function), and URI collections (as retrieved by this function). For example, a collection might return XML documents, and the corresponding URI collection might return the URIs of those documents. However, this specification does not impose such a close relationship. For example, there may be collection URIs accepted by one of the two functions and not by the other; a collection might contain items that do not have any URI; or a URI collection might contain URIs that cannot be dereferenced to return any resource. Thus, some implementations might ensure that calling Primo Secondo Terzo Quarto Quinto ...309 and then applying op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 to each of the returned URIs delivers the same result as calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10 with the same argument; however, this is not guaranteed. In the case where Primo Secondo Terzo Quarto Quinto ...309 returns the URIs of resources that could also be retrieved directly using op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10, there are several reasons why it might be appropriate to use this function in preference to the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10 function. For example:
For some of these use cases, this assumes that the cost of calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)10 might be significant (for example, it might involving retrieving all the documents in the collection over the network and parsing them). This will not necessarily be true of all implementations. 14.6.5 fn:unparsed-textSummaryThe Primo Secondo Terzo Quarto Quinto ...311 function reads an external resource (for example, a file) and returns a string representation of the resource.Signatures Primo Secondo Terzo Quarto Quinto ...311( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244) let $para :=71 let $para :=244 Primo Secondo Terzo Quarto Quinto ...311( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244, Primo Secondo Terzo Quarto Quinto ...409 let $para :=71 let $para :=10) let $para :=71 let $para :=244Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesThe Primo Secondo Terzo Quarto Quinto ...400 argument must be a string in the form of a URI reference, which must contain no fragment identifier, and must identify a resource for which a string representation is available. If the URI is a relative URI reference, then it is resolved relative to the static base URI property from the static context. The mapping of URIs to the string representation of a resource is the mapping defined in the available text resourcesXP31 component of the dynamic context. If the value of the Primo Secondo Terzo Quarto Quinto ...400 argument is an empty sequence, the function returns an empty sequence. The Primo Secondo Terzo Quarto Quinto ...409 argument, if present, is the name of an encoding. The values for this attribute follow the same rules as for the Primo Secondo Terzo Quarto Quinto ...417 attribute in an XML declaration. The only values which every ·implementation· is required to recognize are Primo Secondo Terzo Quarto Quinto ...418 and Primo Secondo Terzo Quarto Quinto ...419. The encoding of the external resource is determined as follows:
The result of the function is a string containing the string representation of the resource retrieved using the URI. Error ConditionsA dynamic error is raised [err:FOUT1170] if Primo Secondo Terzo Quarto Quinto ...400 contains a fragment identifier, or if it cannot be resolved to an absolute URI (for example, because the base-URI property in the static context is absent), or if it cannot be used to retrieve the string representation of a resource. A dynamic error is raised [err:FOUT1190] if the value of the Primo Secondo Terzo Quarto Quinto ...409 argument is not a valid encoding name, if the ·processor· does not support the specified encoding, if the string representation of the retrieved resource contains octets that cannot be decoded into Unicode ·characters· using the specified encoding, or if the resulting characters are not permitted XML characters. A dynamic error is raised [err:FOUT1200] if Primo Secondo Terzo Quarto Quinto ...409 is absent and the ·processor· cannot infer the encoding using external information and the encoding is not UTF-8.Notes If it is appropriate to use a base URI other than the dynamic base URI (for example, when resolving a relative URI reference read from a source document) then it is advisable to resolve the relative URI reference using the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)258 function before passing it to the Primo Secondo Terzo Quarto Quinto ...311 function. There is no essential relationship between the sets of URIs accepted by the two functions Primo Secondo Terzo Quarto Quinto ...311 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 (a URI accepted by one may or may not be accepted by the other), and if a URI is accepted by both there is no essential relationship between the results (different resource representations are permitted by the architecture of the web). There are no constraints on the MIME type of the resource. The fact that the resolution of URIs is defined by a mapping in the dynamic context means that in effect, various aspects of the behavior of this function are ·implementation-defined·. Implementations may provide external configuration options that allow any aspect of the processing to be controlled by the user. In particular:
The rules for determining the encoding are chosen for consistency with [XML Inclusions (XInclude) Version 1.0 (Second Edition)]. Files with an XML media type are treated specially because there are use cases for this function where the retrieved text is to be included as unparsed XML within a CDATA section of a containing document, and because processors are likely to be able to reuse the code that performs encoding detection for XML external entities. If the text file contains characters such as Primo Secondo Terzo Quarto Quinto ...432 and Primo Secondo Terzo Quarto Quinto ...433, these will typically be output as Primo Secondo Terzo Quarto Quinto ...434 and Primo Secondo Terzo Quarto Quinto ...435 if the string is serialized as XML or HTML. If these characters actually represent markup (for example, if the text file contains HTML), then an XSLT stylesheet can attempt to write them as markup to the output file using the Primo Secondo Terzo Quarto Quinto ...436 attribute of the Primo Secondo Terzo Quarto Quinto ...437 instruction. Note, however, that XSLT implementations are not required to support this feature.Examples This XSLT example attempts to read a file containing 'boilerplate' HTML and copy it directly to the serialized output file: Primo Secondo Terzo Quarto Quinto ...5 14.6.6 fn:unparsed-text-linesSummaryThe Primo Secondo Terzo Quarto Quinto ...313 function reads an external resource (for example, a file) and returns its contents as a sequence of strings, one for each line of text in the string representation of the resource.Signatures Primo Secondo Terzo Quarto Quinto ...313( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244) let $para :=71 let $para :=234 Primo Secondo Terzo Quarto Quinto ...313( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244, Primo Secondo Terzo Quarto Quinto ...409 let $para :=71 let $para :=10) let $para :=71 let $para :=234Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesThe Primo Secondo Terzo Quarto Quinto ...454 function reads an external resource (for example, a file) and returns its string representation as a sequence of strings, separated at newline boundaries. The result of the single-argument function is the same as the result of the expression Primo Secondo Terzo Quarto Quinto ...455. The result of the two-argument function is the same as the result of the expression Primo Secondo Terzo Quarto Quinto ...456. The result is thus a sequence of strings containing the text of the resource retrieved using the URI, each string representing one line of text. Lines are separated by one of the sequences x0A, x0D, or x0Dx0A. The characters representing the newline are not included in the returned strings. If there are two adjacent newline sequences, a zero-length string will be returned to represent the empty line; but if the external resource ends with the sequence x0A, x0D, or x0Dx0A, the result will be as if this final line ending were not present. Error ConditionsError conditions are the same as for the Primo Secondo Terzo Quarto Quinto ...311 function.Notes See the notes for Primo Secondo Terzo Quarto Quinto ...311. 14.6.7 fn:unparsed-text-availableSummaryBecause errors in evaluating the Primo Secondo Terzo Quarto Quinto ...311 function are non-recoverable, these two functions are provided to allow an application to determine whether a call with particular arguments would succeed.Signatures Primo Secondo Terzo Quarto Quinto ...315( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 Primo Secondo Terzo Quarto Quinto ...315( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244, Primo Secondo Terzo Quarto Quinto ...409 let $para :=71 let $para :=10) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesThe Primo Secondo Terzo Quarto Quinto ...315 function determines whether a call on the Primo Secondo Terzo Quarto Quinto ...311 function with identical arguments would return a string. If the first argument is an empty sequence, the function returns false. In other cases, the function returns true if a call on Primo Secondo Terzo Quarto Quinto ...311 with the same arguments would succeed, and false if a call on Primo Secondo Terzo Quarto Quinto ...311 with the same arguments would fail with a non-recoverable dynamic error. The functions Primo Secondo Terzo Quarto Quinto ...311 and Primo Secondo Terzo Quarto Quinto ...315 have the same requirement for ·determinism· as the functions op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 and Primo Secondo Terzo Quarto Quinto ...306. This means that unless the user has explicitly stated a requirement for a reduced level of determinism, either of these functions if called twice with the same arguments during the course of a transformation must return the same results each time; moreover, the results of a call on Primo Secondo Terzo Quarto Quinto ...315 must be consistent with the results of a subsequent call on Primo Secondo Terzo Quarto Quinto ...484 with the same arguments.Notes This requires that the Primo Secondo Terzo Quarto Quinto ...315 function should actually attempt to read the resource identified by the URI, and check that it is correctly encoded and contains no characters that are invalid in XML. Implementations may avoid the cost of repeating these checks for example by caching the validated contents of the resource, to anticipate a subsequent call on the Primo Secondo Terzo Quarto Quinto ...311 or Primo Secondo Terzo Quarto Quinto ...313 function. Alternatively, implementations may be able to rewrite an expression such as Primo Secondo Terzo Quarto Quinto ...488 to generate a single call internally. Since the function Primo Secondo Terzo Quarto Quinto ...313 succeeds or fails under exactly the same circumstances as Primo Secondo Terzo Quarto Quinto ...311, the Primo Secondo Terzo Quarto Quinto ...315 function may equally be used to test whether a call on Primo Secondo Terzo Quarto Quinto ...313 would succeed. 14.6.8 fn:environment-variableSummaryReturns the value of a system environment variable, if it exists. SignaturePrimo Secondo Terzo Quarto Quinto ...317( Primo Secondo Terzo Quarto Quinto ...494 let $para :=71 let $para :=10) let $para :=71 let $para :=244Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on environment variables. RulesThe set of available environment variablesXP31 is a set of (name, value) pairs forming part of the dynamic context, in which the name is unique within the set of pairs. The name and value are arbitrary strings. If the Primo Secondo Terzo Quarto Quinto ...494 argument matches the name of one of these pairs, the function returns the corresponding value. If there is no environment variable with a matching name, the function returns the empty sequence. The collation used for matching names is ·implementation-defined·, but must be the same as the collation used to ensure that the names of all environment variables are unique. The function is ·deterministic·, which means that if it is called several times within the same ·execution scope·, with the same arguments, it must return the same result. NotesOn many platforms, the term "environment variable" has a natural meaning in terms of facilities provided by the operating system. This interpretation of the concept does not exclude other interpretations, such as a mapping to a set of configuration parameters in a database system. Environment variable names are usually case sensitive. Names are usually of the form Primo Secondo Terzo Quarto Quinto ...500, but this varies by platform. On some platforms, there may sometimes be multiple environment variables with the same name; in this case, it is implementation-dependent as to which is returned; see for example [POSIX.1-2008] (Chapter 8, Environment Variables). Implementations may use prefixes or other naming conventions to disambiguate the names. The requirement to ensure that the function is deterministic means in practice that the implementation must make a snapshot of the environment variables at some time during execution, and return values obtained from this snapshot, rather than using live values that are subject to change at any time. Operating system environment variables may be associated with a particular process, while queries and stylesheets may execute across multiple processes (or multiple machines). In such circumstances implementations may choose to provide access to the environment variables associated with the process in which the query or stylesheet processing was initiated. Security advice: Queries from untrusted sources should not be permitted unrestricted access to environment variables. For example, the name of the account under which the query is running may be useful information to a would-be intruder. An implementation may therefore choose to restrict access to the environment, or may provide a facility to make Primo Secondo Terzo Quarto Quinto ...317 always return the empty sequence. 14.6.9 fn:available-environment-variablesSummaryReturns a list of environment variable names that are suitable for passing to Primo Secondo Terzo Quarto Quinto ...317, as a (possibly empty) sequence of strings.Signature Primo Secondo Terzo Quarto Quinto ...318() let $para :=71 let $para :=234Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on environment variables. RulesThe function returns a sequence of strings, being the names of the environment variables in the dynamic context in some ·implementation-dependent· order. The function is ·deterministic·: that is, the set of available environment variables does not vary during evaluation. NotesThe function returns a list of strings, containing no duplicates. It is intended that the strings in this list should be suitable for passing to Primo Secondo Terzo Quarto Quinto ...317. See also the note on security under the definition of the Primo Secondo Terzo Quarto Quinto ...317 function. If access to environment variables has been disabled, Primo Secondo Terzo Quarto Quinto ...318 always returns the empty sequence. 14.7 Parsing and serializingThese functions convert between the lexical representation of XML and the tree representation. FunctionMeaningop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19This function takes as input an XML document represented as a string, and returns the document node at the root of an XDM tree representing the parsed document. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)20This function takes as input an XML external entity represented as a string, and returns the document node at the root of an XDM tree representing the parsed document fragment. Primo Secondo Terzo Quarto Quinto ...511This function serializes the supplied input sequence let $para :=25 as described in [XSLT and XQuery Serialization 3.1], returning the serialized representation of the sequence as a string. 14.7.1 fn:parse-xmlSummaryThis function takes as input an XML document represented as a string, and returns the document node at the root of an XDM tree representing the parsed document. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19( let $para :=25 let $para :=71 let $para :=244) let $para :=71 Primo Secondo Terzo Quarto Quinto ...518Properties This function is ·nondeterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. The precise process used to construct the XDM instance is ·implementation-defined·. In particular, it is implementation-defined whether DTD and/or schema validation is invoked, and it is implementation-defined whether an XML 1.0 or XML 1.1 parser is used. The static base URI property from the static context of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 function call is used both as the base URI used by the XML parser to resolve relative entity references within the document, and as the base URI of the document node that is returned. The document URI of the returned node is ·absent·. The function is not ·deterministic·: that is, if the function is called twice with the same arguments, it is ·implementation-dependent· whether the same node is returned on both occasions. Error ConditionsA dynamic error is raised [err:FODC0006] if the content of let $para :=25 is not a well-formed and namespace-well-formed XML document. A dynamic error is raised [err:FODC0006] if DTD-based validation is carried out and the content of let $para :=25 is not valid against its DTD.Notes Since the XML document is presented to the parser as a string, rather than as a sequence of octets, the encoding specified within the XML declaration has no meaning. If the XML parser accepts input only in the form of a sequence of octets, then the processor must ensure that the string is encoded as octets in a way that is consistent with rules used by the XML parser to detect the encoding. The primary use case for this function is to handle input documents that contain nested XML documents embedded within CDATA sections. Since the content of the CDATA section are exposed as text, the receiving query or stylesheet may pass this text to the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 function to create a tree representation of the nested document. Similarly, nested XML within comments is sometimes encountered, and lexical XML is sometimes returned by extension functions, for example, functions that access web services or read from databases. A use case arises in XSLT where there is a need to preprocess an input document before parsing. For example, an application might wish to edit the document to remove its DOCTYPE declaration. This can be done by reading the raw text using the Primo Secondo Terzo Quarto Quinto ...311 function, editing the resulting string, and then passing it to the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 function.Examples The expression Primo Secondo Terzo Quarto Quinto ...526 returns a newly created document node, having an Primo Secondo Terzo Quarto Quinto ...527 element as its only child; the Primo Secondo Terzo Quarto Quinto ...527 element in turn is the parent of a text node whose string value is Primo Secondo Terzo Quarto Quinto ...529. 14.7.2 fn:parse-xml-fragmentSummaryThis function takes as input an XML external entity represented as a string, and returns the document node at the root of an XDM tree representing the parsed document fragment. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)20( let $para :=25 let $para :=71 let $para :=244) let $para :=71 Primo Secondo Terzo Quarto Quinto ...326Properties This function is ·nondeterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesIf let $para :=25 is the empty sequence, the function returns the empty sequence. The input must be a namespace-well-formed external general parsed entity. More specifically, it must be a string conforming to the production rule extParsedEntxml in [Extensible Markup Language (XML) 1.0 (Fifth Edition)], it must contain no entity references other than references to predefined entities, and it must satisfy all the rules of [Namespaces in XML] for namespace-well-formed documents with the exception that the rule requiring it to be a well-formed document is replaced by the rule requiring it to be a well-formed external general parsed entity. The string is parsed to form a sequence of nodes which become children of the new document node, in the same way as the content of any element is converted into a sequence of children for the resulting element node. Schema validation is not invoked, which means that the nodes in the returned document will all be untyped. The precise process used to construct the XDM instance is ·implementation-defined·. In particular, it is implementation-defined whether an XML 1.0 or XML 1.1 parser is used. The static base URI from the static context of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)20 function call is used as the base URI of the document node that is returned. The document URI of the returned node is ·absent·. The function is not ·deterministic·: that is, if the function is called twice with the same arguments, it is ·implementation-dependent· whether the same node is returned on both occasions. Error ConditionsA dynamic error is raised [err:FODC0006] if the content of let $para :=25 is not a well-formed external general parsed entity, if it contains entity references other than references to predefined entities, or if a document that incorporates this well-formed parsed entity would not be namespace-well-formed.Notes See also the notes for the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 function. The main differences between op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)20 are that for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19, the children of the resulting document node must contain exactly one element node and no text nodes, wheras for op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)20, the resulting document node can have any number (including zero) of element and text nodes among its children. An additional difference is that the text declaration at the start of an external entity has slightly different syntax from the XML declaration at the start of a well-formed document. Note that all whitespace outside the text declaration is significant, including whitespace that precedes the first element node. One use case for this function is to handle XML fragments stored in databases, which frequently allow zero-or-more top level element nodes. Another use case is to parse the contents of a Primo Secondo Terzo Quarto Quinto ...544 section embedded within another XML document.Examples The expression Primo Secondo Terzo Quarto Quinto ...545 returns a newly created document node, having two elements named Primo Secondo Terzo Quarto Quinto ...527 and Primo Secondo Terzo Quarto Quinto ...547 as its children; each of these elements in turn is the parent of a text node. The expression Primo Secondo Terzo Quarto Quinto ...548 returns a newly created document node having three children: a text node whose string value is Primo Secondo Terzo Quarto Quinto ...549, an element node named let $para :=274 having a child text node with string value Primo Secondo Terzo Quarto Quinto ...551, and a text node whose string value is Primo Secondo Terzo Quarto Quinto ...552. The expression Primo Secondo Terzo Quarto Quinto ...553 returns a document node having no children. The expression Primo Secondo Terzo Quarto Quinto ...554 returns a document node whose children comprise a single text node whose string value is a single space. The expression Primo Secondo Terzo Quarto Quinto ...555 results in a dynamic error [err:FODC0006] because the "standalone" keyword is not permitted in the text declaration that appears at the start of an external general parsed entity. (Thus, it is not the case that any input accepted by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 function will also be accepted by op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)20.) 14.7.3 fn:serializeSummaryThis function serializes the supplied input sequence let $para :=25 as described in [XSLT and XQuery Serialization 3.1], returning the serialized representation of the sequence as a string.Signatures Primo Secondo Terzo Quarto Quinto ...511( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 let $para :=10 Primo Secondo Terzo Quarto Quinto ...511( let $para :=25 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...569 let $para :=71 let $para :=79) let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe value of the first argument let $para :=25 acts as the input sequence to the serialization process, which starts with sequence normalization. The second argument Primo Secondo Terzo Quarto Quinto ...569, if present, provides serialization parameters. These may be supplied in either of two forms:
The single-argument version of this function has the same effect as the two-argument version called with Primo Secondo Terzo Quarto Quinto ...569 set to an empty sequence. This in turn is the same as the effect of passing an Primo Secondo Terzo Quarto Quinto ...576 element with no child elements. The final stage of serialization, that is, encoding, is skipped. If the serializer does not allow this phase to be skipped, then the sequence of octets returned by the serializer is decoded into a string by reversing the character encoding performed in the final stage. If the second argument is omitted, or is supplied in the form of an Primo Secondo Terzo Quarto Quinto ...576 element, then the values of any serialization parameters that are not explicitly specified is ·implementation-defined·, and may depend on the context. If the second argument is supplied as a map, then the ·option parameter conventions· apply. In this case:
Primo Secondo Terzo Quarto Quinto ...584 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=095 Primo Secondo Terzo Quarto Quinto ...589 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=095 Primo Secondo Terzo Quarto Quinto ...594 Primo Secondo Terzo Quarto Quinto ...595 let $para :=96 Primo Secondo Terzo Quarto Quinto ...597 let $para :=244Zero-length string and let $para :=96 both represent "absent"absent Primo Secondo Terzo Quarto Quinto ...600 let $para :=244Zero-length string and let $para :=96 both represent "absent"absent Primo Secondo Terzo Quarto Quinto ...417 let $para :=244 Primo Secondo Terzo Quarto Quinto ...418 Primo Secondo Terzo Quarto Quinto ...606 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=097 Primo Secondo Terzo Quarto Quinto ...611 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)728 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21 Primo Secondo Terzo Quarto Quinto ...614 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=097 Primo Secondo Terzo Quarto Quinto ...619 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=095 Primo Secondo Terzo Quarto Quinto ...624 let $para :=244absent Primo Secondo Terzo Quarto Quinto ...626 Primo Secondo Terzo Quarto Quinto ...627See Notes 1, 2 Primo Secondo Terzo Quarto Quinto ...628 Primo Secondo Terzo Quarto Quinto ...629 let $para :=244(a media type suitable for the chosen Primo Secondo Terzo Quarto Quinto ...631) Primo Secondo Terzo Quarto Quinto ...631 Primo Secondo Terzo Quarto Quinto ...627See Notes 1, 2 Primo Secondo Terzo Quarto Quinto ...628 Primo Secondo Terzo Quarto Quinto ...635 let $para :=244 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)90 Primo Secondo Terzo Quarto Quinto ...638 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=097 Primo Secondo Terzo Quarto Quinto ...643 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no", let $para :=96 means "omit" Primo Secondo Terzo Quarto Quinto ...648 Primo Secondo Terzo Quarto Quinto ...649 Primo Secondo Terzo Quarto Quinto ...595 let $para :=96 Primo Secondo Terzo Quarto Quinto ...652 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)63 let $para :=182 means "yes", let $para :=184 means "no" let $para :=095 Primo Secondo Terzo Quarto Quinto ...657 Primo Secondo Terzo Quarto Quinto ...658See Note 3 Primo Secondo Terzo Quarto Quinto ...659 Primo Secondo Terzo Quarto Quinto ...660 let $para :=244 Primo Secondo Terzo Quarto Quinto ...662 Notes to the table:
A type error [err:XPTY0004]XP31 occurs if the second argument is present and does not match either of the types Primo Secondo Terzo Quarto Quinto ...674 or let $para :=32. Note: This is defined as a type error so that it can be enforced via the function signature by implementations that generalize the type system in a suitable way. If the host language makes serialization an optional feature and the implementation does not support serialization, then a dynamic error [err:FODC0010] is raised. The serialization process will raise an error if let $para :=25 is an attribute or namespace node. When the second argument is supplied as a map, and the supplied value is of the wrong type for the particular parameter, for example if the value of Primo Secondo Terzo Quarto Quinto ...619 is a string rather than a boolean, then as defined by the ·option parameter conventions·, a type error [err:XPTY0004]XP31 is raised. If the value is of the correct type, but does not satisfy the rules for that parameter defined in [XSLT and XQuery Serialization 3.1], then a dynamic error [err:SEPM0016]SER31 is raised. (For example, this occurs if the map supplied to Primo Secondo Terzo Quarto Quinto ...657 includes a key that is a string whose length is not one (1)). If any serialization error occurs, including the detection of an invalid value for a serialization parameter as described above, this results in the Primo Secondo Terzo Quarto Quinto ...511 call failing with a dynamic error.Notes One use case for this function arises when there is a need to construct an XML document containing nested XML documents within a CDATA section (or on occasions within a comment). See op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)19 for further details. Another use case arises when there is a need to call an extension function that expects a lexical XML document as input. There are also use cases where the application wants to post-process the output of a query or transformation, for example by adding an internal DTD subset, or by inserting proprietary markup delimiters such as the Primo Secondo Terzo Quarto Quinto ...681 used by some templating languages. The ability to specify the serialization parameters in an Primo Secondo Terzo Quarto Quinto ...576 element provides backwards compatibility with the 3.0 version of this specification; the ability to use a map takes advantage of new features in the 3.1 version. The default parameter values are implementation-defined when an Primo Secondo Terzo Quarto Quinto ...576 element is used (or when the argument is omitted), but are fixed by this specification in the case where a map (including an empty map) is supplied for the argument.Examples Given the variables: Primo Secondo Terzo Quarto Quinto ...6 Primo Secondo Terzo Quarto Quinto ...7 The following call might produce the output shown: The expression Primo Secondo Terzo Quarto Quinto ...684 returns Primo Secondo Terzo Quarto Quinto ...685. The following call would also produce the output shown (though the second argument could equally well be supplied as an empty map ( Primo Secondo Terzo Quarto Quinto ...659), since both parameters are given their default values): The expression Primo Secondo Terzo Quarto Quinto ...687 returns Primo Secondo Terzo Quarto Quinto ...685. 15 Context functionsThe following functions are defined to obtain information from the static or dynamic context. FunctionMeaningPrimo Secondo Terzo Quarto Quinto ...689Returns the context position from the dynamic context. Primo Secondo Terzo Quarto Quinto ...690Returns the context size from the dynamic context. let $para :=69Returns the current date and time (with timezone). let $para :=80Returns the current date. let $para :=82Returns the current time. let $para :=84Returns the value of the implicit timezone property from the dynamic context. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)07Returns the value of the default collation property from the static context. let $para :=83Returns the value of the default language property from the dynamic context. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)08This function returns the value of the static base URI property from the static context. 15.1 fn:positionSummaryReturns the context position from the dynamic context. SignaturePrimo Secondo Terzo Quarto Quinto ...689() let $para :=71 let $para :=85Properties This function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. RulesReturns the context position from the dynamic context. (See Section C.2 Dynamic Context Components XP31.) Error ConditionsA dynamic error is raised [err:XPDY0002]XP31 if the context item is absentDM31. 15.2 fn:lastSummaryReturns the context size from the dynamic context. SignaturePrimo Secondo Terzo Quarto Quinto ...690() let $para :=71 let $para :=85Properties This function is ·deterministic·, ·context-dependent·, and ·focus-dependent·. RulesReturns the context size from the dynamic context. (See Section C.2 Dynamic Context Components XP31.) Error ConditionsA dynamic error is raised [err:XPDY0002]XP31 if the context size is absentDM31. NotesUnder most circumstances, the context size is absent only if the context item is absent. However, XSLT 3.0 with streaming defines situations in which the context item and context position are known, but the context size is unknown. ExamplesThe expression Primo Secondo Terzo Quarto Quinto ...704 returns Primo Secondo Terzo Quarto Quinto ...705. 15.3 fn:current-dateTimeSummaryReturns the current date and time (with timezone). Signaturelet $para :=69() let $para :=71 let $para :=23Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesReturns the current dateTime (with timezone) from the dynamic context. (See Section C.2 Dynamic Context Components XP31.) This is an let $para :=29 that is current at some time during the evaluation of a query or transformation in which let $para :=69 is executed. This function is ·deterministic·. The precise instant during the query or transformation represented by the value of let $para :=019 is ·implementation-dependent·. If the implementation supports data types from XSD 1.1 then the returned value will be an instance of let $para :=23. Otherwise, the only guarantees are that it will be an instance of let $para :=29 and will have a timezone component.Notes The returned let $para :=29 will always have an associated timezone, which will always be the same as the implicit timezone in the dynamic contextExamples let $para :=019 returns an let $para :=23 corresponding to the current date and time. For example, a call of let $para :=019 might return Primo Secondo Terzo Quarto Quinto ...718 corresponding to the current time on May 12, 2004 in timezone fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).073. 15.4 fn:current-dateSummaryReturns the current date. Signaturelet $para :=80() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesReturns Primo Secondo Terzo Quarto Quinto ...723. This is an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 (with timezone) that is current at some time during the evaluation of a query or transformation in which let $para :=80 is executed. This function is ·deterministic·. The precise instant during the query or transformation represented by the value of let $para :=80 is ·implementation-dependent·.Notes The returned date will always have an associated timezone, which will always be the same as the implicit timezone in the dynamic context ExamplesPrimo Secondo Terzo Quarto Quinto ...727 returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964 corresponding to the current date. For example, a call of Primo Secondo Terzo Quarto Quinto ...727 might return Primo Secondo Terzo Quarto Quinto ...730. 15.5 fn:current-timeSummaryReturns the current time. Signaturelet $para :=82() let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesReturns Primo Secondo Terzo Quarto Quinto ...734. This is an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 (with timezone) that is current at some time during the evaluation of a query or transformation in which let $para :=82 is executed. This function is ·deterministic·. The precise instant during the query or transformation represented by the value of Primo Secondo Terzo Quarto Quinto ...737 is ·implementation-dependent·.Notes The returned time will always have an associated timezone, which will always be the same as the implicit timezone in the dynamic context ExamplesPrimo Secondo Terzo Quarto Quinto ...737 returns an op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)965 corresponding to the current time. For example, a call of Primo Secondo Terzo Quarto Quinto ...737 might return Primo Secondo Terzo Quarto Quinto ...741. 15.6 fn:implicit-timezoneSummaryReturns the value of the implicit timezone property from the dynamic context. Signaturelet $para :=84() let $para :=71 let $para :=25Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on implicit timezone. RulesReturns the value of the implicit timezone property from the dynamic context. Components of the dynamic context are described in Section C.2 Dynamic Context Components XP31. 15.7 fn:default-collationSummaryReturns the value of the default collation property from the static context. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)07() let $para :=71 let $para :=10Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. RulesReturns the value of the default collation property from the static context. Components of the static context are described in Section C.1 Static Context Components XP31. NotesThe default collation property can never be absent. If it is not explicitly defined, a system defined default can be invoked. If this is not provided, the Unicode codepoint collation ( let $para :=078) is used. 15.8 fn:default-languageSummaryReturns the value of the default language property from the dynamic context. Signaturelet $para :=83() let $para :=71 let $para :=101Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on default language. RulesReturns the value of the default language property from the dynamic context. Components of the dynamic context are described in Section 2.1.2 Dynamic Context XP31. NotesThe default language property can never be absent. The functions let $para :=225, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).342, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).344, and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).340 are defined to use the default language if no explicit language is supplied. The default language may play a role in selection of a default collation, but this is not a requirement. 15.9 fn:static-base-uriSummaryThis function returns the value of the static base URI property from the static context. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)08() let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)44Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesThe function returns the value of the static base URI property from the static context. If the property is absent, the empty sequence is returned. Components of the static context are described in Section 2.1.1 Static Context XP31 . NotesXQuery 3.0 and XSLT 3.0 give an implementation freedom to use different base URIs during the static analysis phase and the dynamic evaluation phase, that is, for compile-time and run-time resources respectively. This is appropriate when the implementation allows the output of static analysis (a "compiled" query or stylesheet) to be deployed for execution to a different location from the one where static analysis took place. In this situation, the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)08 function should return a URI suitable for locating resources needed during dynamic evaluation. 16 Higher-order functions16.1 Functions on functionsThe functions included in this section operate on function items, that is, values referring to a function. [Definition] Functions that accept functions among their arguments, or that return functions in their result, are described in this specification as higher-order functions. Some host languages may exclude higher-order functions from the set of functions that they support, or may include such functions in an optional conformance feature. Note: Some functions such as Primo Secondo Terzo Quarto Quinto ...760 allow the option of supplying a callback function for example to define exception behavior. Where this is not essential to the use of the function, the function has not been classified as higher-order for this purpose; in applications where function items cannot be created, these particular options will not be available.FunctionMeaning let $para :=77Returns the function having a given name and arity, if there is one. let $para :=90Returns the name of the function identified by a function item. Primo Secondo Terzo Quarto Quinto ...763Returns the arity of the function identified by a function item. 16.1.1 fn:function-lookupSummaryReturns the function having a given name and arity, if there is one. Signaturelet $para :=77( Primo Secondo Terzo Quarto Quinto ...494 let $para :=71 let $para :=36, Primo Secondo Terzo Quarto Quinto ...768 let $para :=71 let $para :=85) let $para :=71 Primo Secondo Terzo Quarto Quinto ...772Properties This function is ·deterministic·, ·context-dependent·, ·focus-dependent·, and ·higher-order·. RulesA call to let $para :=77 returns the function obtained by looking up the expanded QName supplied as Primo Secondo Terzo Quarto Quinto ...494 and the arity supplied as Primo Secondo Terzo Quarto Quinto ...768 in the named functions component of the dynamic context (specifically, the dynamic context of the call to let $para :=77). Furthermore, if that function has an implementation-dependent implementation (see note below), then the implementation of the function returned by let $para :=77 is associated with the static and dynamic context of the call to let $para :=77. Note: The above rule deliberately uses the same wording as the corresponding rule for Named Function References. The term "a function [with] an implementation-dependent implementation" essentially means a function whose implementation is provided by the language processor rather than by the stylesheet or query author. This rule is therefore relevant to built-in functions and vendor-supplied extension functions whose result depends on the context of the function call. Otherwise (if no known function can be identified by name and arity), an empty sequence is returned. If the arguments to let $para :=77 identify a function that is present in the static context of the function call, the function will always return the same function that a static reference to this function would bind to. If there is no such function in the static context, then the results depend on what is present in the dynamic context, which is ·implementation-defined·.Notes This function can be useful where there is a need to make a dynamic decision on which of several statically-known functions to call. It can thus be used as a substitute for polymorphism, in the case where the application has been designed so several functions implement the same interface. The function can also be useful in cases where a query or stylesheet module is written to work with alternative versions of a library module. In such cases the author of the main module might wish to test whether an imported library module contains or does not contain a particular function, and to call a function in that module only if it is available in the version that was imported. A static call would cause a static error if the function is not available, whereas getting the function using let $para :=77 allows the caller to take fallback action in this situation. If the function that is retrieved by let $para :=77 is ·context-dependent·, that is, if it has dependencies on the static or dynamic context of its caller, the context that applies is the static and/or dynamic context of the call to the let $para :=77 function itself. The context thus effectively forms part of the closure of the returned function. In practice this applies only where the target of let $para :=77 is a built-in function, because user-defined functions never depend on the static or dynamic context of the function call. The rule applies recursively, since let $para :=77 is itself a context-dependent built-in function. These specifications do not define any circumstances in which the dynamic context will contain functions that are not present in the static context, but neither do they rule this out. For example an API may provide the ability to add functions to the dynamic context. Equally, these specifications do not define any mechanism for creating context-dependent functions other than the built-in context-dependent functions, but neither do they rule out the existence of such functions. The mere fact that a function exists and has a name does not of itself mean that the function is present in the dynamic context. For example, functions obtained through use of the Primo Secondo Terzo Quarto Quinto ...785 function are not added to the dynamic context.Examples The expression Primo Secondo Terzo Quarto Quinto ...786 returns Primo Secondo Terzo Quarto Quinto ...787. The expression Primo Secondo Terzo Quarto Quinto ...788 returns an let $para :=29 value set to the specified date, time, and timezone; if the implementation supports XSD 1.1 then the result will be an instance of the derived type let $para :=23. The query is written to ensure that no failure occurs when the implementation does not recognize the type let $para :=23. The expression Primo Secondo Terzo Quarto Quinto ...792 returns the result of calling Primo Secondo Terzo Quarto Quinto ...793 if the function is available, or an empty sequence otherwise. 16.1.2 fn:function-nameSummaryReturns the name of the function identified by a function item. Signaturelet $para :=90( Primo Secondo Terzo Quarto Quinto ...795 let $para :=71 Primo Secondo Terzo Quarto Quinto ...797) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)47Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesIf Primo Secondo Terzo Quarto Quinto ...795 refers to a named function, Primo Secondo Terzo Quarto Quinto ...801 returns the name of that function. Otherwise ( Primo Secondo Terzo Quarto Quinto ...795 refers to an anonymous function), Primo Secondo Terzo Quarto Quinto ...801 returns an empty sequence. The prefix part of the returned QName is ·implementation-dependent·. ExamplesThe expression Primo Secondo Terzo Quarto Quinto ...804 returns Primo Secondo Terzo Quarto Quinto ...805. (The namespace prefix of the returned QName is not predictable.) The expression Primo Secondo Terzo Quarto Quinto ...806 returns let $para :=96. 16.1.3 fn:function-aritySummaryReturns the arity of the function identified by a function item. SignaturePrimo Secondo Terzo Quarto Quinto ...763( Primo Secondo Terzo Quarto Quinto ...795 let $para :=71 Primo Secondo Terzo Quarto Quinto ...797) let $para :=71 let $para :=85Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe Primo Secondo Terzo Quarto Quinto ...763 function returns the arity (number of arguments) of the function identified by Primo Secondo Terzo Quarto Quinto ...795. The expression Primo Secondo Terzo Quarto Quinto ...816 returns let $para :=226. The expression Primo Secondo Terzo Quarto Quinto ...818 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. The expression Primo Secondo Terzo Quarto Quinto ...820 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 16.2 Basic higher-order functionsThe following functions take function items as an argument. FunctionMeaningPrimo Secondo Terzo Quarto Quinto ...822Applies the function item $action to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order. Primo Secondo Terzo Quarto Quinto ...823Returns those items from the sequence $seq for which the supplied function $f returns true. Primo Secondo Terzo Quarto Quinto ...824Processes the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value. Primo Secondo Terzo Quarto Quinto ...825Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value. Primo Secondo Terzo Quarto Quinto ...826Applies the function item $action to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order. Primo Secondo Terzo Quarto Quinto ...827Sorts a supplied sequence, based on the value of a sort key supplied as a function. Primo Secondo Terzo Quarto Quinto ...828Makes a dynamic call on a function with an argument list supplied in the form of an array. With all these functions, if the caller-supplied function fails with a dynamic error, this error is propagated as an error from the higher-order function itself. 16.2.1 fn:for-eachSummaryApplies the function item $action to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order. SignaturePrimo Secondo Terzo Quarto Quinto ...822( let $para :=021 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...833 let $para :=71 Primo Secondo Terzo Quarto Quinto ...835) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following implementation in XQuery: Primo Secondo Terzo Quarto Quinto ...8 or its equivalent in XSLT: Primo Secondo Terzo Quarto Quinto ...9Notes The function call Primo Secondo Terzo Quarto Quinto ...838 is equivalent to the expression Primo Secondo Terzo Quarto Quinto ...839, assuming that ordering mode is Primo Secondo Terzo Quarto Quinto ...840.Examples The expression Primo Secondo Terzo Quarto Quinto ...841 returns Primo Secondo Terzo Quarto Quinto ...842. The expression Primo Secondo Terzo Quarto Quinto ...843 returns Primo Secondo Terzo Quarto Quinto ...844. The expression Primo Secondo Terzo Quarto Quinto ...845 returns Primo Secondo Terzo Quarto Quinto ...846. 16.2.2 fn:filterSummaryReturns those items from the sequence $seq for which the supplied function $f returns true. SignaturePrimo Secondo Terzo Quarto Quinto ...823( let $para :=021 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...851 let $para :=71 Primo Secondo Terzo Quarto Quinto ...853) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following implementation in XQuery: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0 or its equivalent in XSLT: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1Error Conditions As a consequence of the function signature and the function calling rules, a type error occurs if the supplied function $f returns anything other than a single op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 item; there is no conversion to an effective boolean value.Notes The function call Primo Secondo Terzo Quarto Quinto ...857 has a very similar effect to the expression Primo Secondo Terzo Quarto Quinto ...858. There are some differences, however. In the case of Primo Secondo Terzo Quarto Quinto ...823, the function Primo Secondo Terzo Quarto Quinto ...860 is required to return a boolean; there is no special treatment for numeric predicate values, and no conversion to an effective boolean value. Also, with a filter expression Primo Secondo Terzo Quarto Quinto ...858, the focus within the predicate is different from that outside; this means that the use of a context-sensitive function such as let $para :=95 will give different results in the two cases.Examples The expression Primo Secondo Terzo Quarto Quinto ...863 returns Primo Secondo Terzo Quarto Quinto ...864. The expression Primo Secondo Terzo Quarto Quinto ...865 returns let $para :=96. 16.2.3 fn:fold-leftSummaryProcesses the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value. SignaturePrimo Secondo Terzo Quarto Quinto ...824( let $para :=021 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...975 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...851 let $para :=71 Primo Secondo Terzo Quarto Quinto ...876) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following implementation in XQuery: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);2 or its equivalent in XSLT: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);3Error Conditions As a consequence of the function signature and the function calling rules, a type error occurs if the supplied function $f cannot be applied to two arguments, where the first argument is either the value of $zero or the result of a previous application of $f, and the second is any single item from the sequence $seq. NotesThis operation is often referred to in the functional programming literature as "folding" or "reducing" a sequence. It takes a function that operates on a pair of values, and applies it repeatedly, with an accumulated result as the first argument, and the next item in the sequence as the second argument. The accumulated result is initially set to the value of the $zero argument, which is conventionally a value (such as zero in the case of addition, one in the case of multiplication, or a zero-length string in the case of string concatenation) that causes the function to return the value of the other argument unchanged. ExamplesThe expression Primo Secondo Terzo Quarto Quinto ...879 returns let $para :=222. (This returns the sum of the items in the sequence). The expression Primo Secondo Terzo Quarto Quinto ...881 returns Primo Secondo Terzo Quarto Quinto ...882. (This returns the product of the items in the sequence). The expression Primo Secondo Terzo Quarto Quinto ...883 returns let $para :=182. (This returns true if any item in the sequence has an effective boolean value of true). The expression Primo Secondo Terzo Quarto Quinto ...885 returns let $para :=184. (This returns true only if every item in the sequence has an effective boolean value of true). The expression Primo Secondo Terzo Quarto Quinto ...887 returns Primo Secondo Terzo Quarto Quinto ...888. (This reverses the order of the items in a sequence). The expression Primo Secondo Terzo Quarto Quinto ...889 returns Primo Secondo Terzo Quarto Quinto ...890. The expression Primo Secondo Terzo Quarto Quinto ...891 returns Primo Secondo Terzo Quarto Quinto ...892. The expression Primo Secondo Terzo Quarto Quinto ...893 returns Primo Secondo Terzo Quarto Quinto ...894. 16.2.4 fn:fold-rightSummaryProcesses the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value. SignaturePrimo Secondo Terzo Quarto Quinto ...825( let $para :=021 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, 1º 2º 3º 4º ...975 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...851 let $para :=71 Primo Secondo Terzo Quarto Quinto ...904) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following implementation in XQuery: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);4 or its equivalent in XSLT: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);5Error Conditions As a consequence of the function signature and the function calling rules, a type error occurs if the supplied function $f cannot be applied to two arguments, where the first argument is any item in the sequence $seq, and the second is either the value of $zero or the result of a previous application of $f. NotesThis operation is often referred to in the functional programming literature as "folding" or "reducing" a sequence. It takes a function that operates on a pair of values, and applies it repeatedly, with the next item in the sequence as the first argument, and the result of processing the remainder of the sequence as the second argument. The accumulated result is initially set to the value of the $zero argument, which is conventionally a value (such as zero in the case of addition, one in the case of multiplication, or a zero-length string in the case of string concatenation) that causes the function to return the value of the other argument unchanged. In cases where the function performs an associative operation on its two arguments (such as addition or multiplication), Primo Secondo Terzo Quarto Quinto ...825 produces the same result as Primo Secondo Terzo Quarto Quinto ...824.Examples The expression Primo Secondo Terzo Quarto Quinto ...909 returns let $para :=222. (This returns the sum of the items in the sequence). The expression Primo Secondo Terzo Quarto Quinto ...911 returns Primo Secondo Terzo Quarto Quinto ...912. The expression Primo Secondo Terzo Quarto Quinto ...913 returns Primo Secondo Terzo Quarto Quinto ...914. 16.2.5 fn:for-each-pairSummaryApplies the function item $action to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order. SignaturePrimo Secondo Terzo Quarto Quinto ...826( Primo Secondo Terzo Quarto Quinto ...916 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...919 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...833 let $para :=71 Primo Secondo Terzo Quarto Quinto ...924) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following implementation in XQuery: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);6 or its equivalent in XSLT: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);7Notes If one sequence is longer than the other, excess items in the longer sequence are ignored. ExamplesThe expression Primo Secondo Terzo Quarto Quinto ...927 returns Primo Secondo Terzo Quarto Quinto ...928. The expression Primo Secondo Terzo Quarto Quinto ...929 returns Primo Secondo Terzo Quarto Quinto ...930. The expression Primo Secondo Terzo Quarto Quinto ...931 returns Primo Secondo Terzo Quarto Quinto ...932. 16.2.6 fn:sortSummarySorts a supplied sequence, based on the value of a sort key supplied as a function. SignaturesPrimo Secondo Terzo Quarto Quinto ...827( let $para :=232 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16 Primo Secondo Terzo Quarto Quinto ...827( let $para :=232 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, let $para :=128 let $para :=71 let $para :=244) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16 Primo Secondo Terzo Quarto Quinto ...827( let $para :=232 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, let $para :=128 let $para :=71 let $para :=244, let $para :=192 let $para :=71 Primo Secondo Terzo Quarto Quinto ...957) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The three-argument form of this function is ·deterministic·, ·context-dependent·, ·focus-independent·, and ·higher-order·. It depends on collations. RulesCalling the single-argument version of the function is equivalent to calling the two-argument form with Primo Secondo Terzo Quarto Quinto ...960 as the second argument: that is, it sorts a sequence of items according to the typed value of the items, using the default collation to compare strings. Calling the two-argument version of the function is equivalent to calling the three-argument form with Primo Secondo Terzo Quarto Quinto ...961 as the third argument: that is, it sorts a sequence of items according to the typed value of the items, using a specified collation to compare strings. In the case of both Primo Secondo Terzo Quarto Quinto ...962 and Primo Secondo Terzo Quarto Quinto ...963, supplying an empty sequence as the second argument is equivalent to supplying Primo Secondo Terzo Quarto Quinto ...964. For more information on collations see 5.3.5 Choosing a collation. The result of the function is obtained as follows:
If the set of computed sort keys contains values that are not comparable using the 1º 2º 3º 4º ...949 operator then the sort operation will fail with a type error ([err:XPTY0004]XP31).Notes XSLT and XQuery both provide native sorting capability, but previous releases of XPath provided no sorting functionality for use in standalone environments. In addition there are cases where this function may be more flexible than the built-in sorting capability for XQuery or XSLT, for example when the sort key or collation is chosen dynamically, or when the sort key is a sequence of items rather than a single item. The results are compatible with the results of XSLT sorting (using Primo Secondo Terzo Quarto Quinto ...983) in the case where the sort key evaluates to a sequence of length zero or one, given the options Primo Secondo Terzo Quarto Quinto ...984 and Primo Secondo Terzo Quarto Quinto ...985. The results are compatible with the results of XQuery sorting (using the let $para :=220 clause) in the case where the sort key evaluates to a sequence of length zero or one, given the options Primo Secondo Terzo Quarto Quinto ...987, Primo Secondo Terzo Quarto Quinto ...988, and Primo Secondo Terzo Quarto Quinto ...989.Examples The expression Primo Secondo Terzo Quarto Quinto ...990 returns Primo Secondo Terzo Quarto Quinto ...991. The expression Primo Secondo Terzo Quarto Quinto ...992 returns Primo Secondo Terzo Quarto Quinto ...993. To sort a set of strings 1º 2º 3º 4º ...336 using Swedish collation: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);9 To sort a sequence of employees by last name as the major sort key and first name as the minor sort key, using the default collation: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'0 16.2.7 fn:applySummaryMakes a dynamic call on a function with an argument list supplied in the form of an array. SignaturePrimo Secondo Terzo Quarto Quinto ...828( Primo Secondo Terzo Quarto Quinto ...996 let $para :=71 Primo Secondo Terzo Quarto Quinto ...797, Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe result of the function is obtained by invoking the supplied function Primo Secondo Terzo Quarto Quinto ...996 with arguments taken from the members of the supplied array Primo Secondo Terzo Quarto Quinto ...999. The first argument of the function call is the first member of Primo Secondo Terzo Quarto Quinto ...999, the second argument is the second member of Primo Secondo Terzo Quarto Quinto ...999, and so on. The arity of the supplied function Primo Secondo Terzo Quarto Quinto ...996 must be the same as the size of the array Primo Secondo Terzo Quarto Quinto ...999. The effect of calling declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);010 is the same as the effect of the dynamic function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);011. For example, the function conversion rules are applied to the supplied arguments in the usual way.Error Conditions A dynamic error is raised if the arity of the function Primo Secondo Terzo Quarto Quinto ...996 is not the same as the size of the array Primo Secondo Terzo Quarto Quinto ...999 ([err:FOAP0001]).Notes The function is useful where the arity of a function item is not known statically. ExamplesThe expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);014 returns let $para :=803. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);016 calls the supplied function Primo Secondo Terzo Quarto Quinto ...851 supplying the number of arguments required by its arity. 16.3 Dynamic LoadingThe following functions allow dynamic loading and execution of XQuery queries and XSLT stylesheets. FunctionMeaningPrimo Secondo Terzo Quarto Quinto ...785Provides access to the public functions and global variables of a dynamically-loaded XQuery library module. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019Invokes a transformation using a dynamically-loaded XSLT stylesheet. 16.3.1 fn:load-xquery-moduleSummaryProvides access to the public functions and global variables of a dynamically-loaded XQuery library module. SignaturesPrimo Secondo Terzo Quarto Quinto ...785( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);021 let $para :=71 let $para :=10) let $para :=71 let $para :=32 Primo Secondo Terzo Quarto Quinto ...785( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);021 let $para :=71 let $para :=10, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 let $para :=32Properties This function is ·deterministic·, ·context-dependent·, ·focus-independent·, and ·higher-order·. RulesThe function loads an implementation-defined set of modules having the target namespace declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);021. Calling the one-argument version of the function has the same effect as calling the two-argument version with an empty map as the second argument. The declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument can be used to control the way in which the function operates. The ·option parameter conventions· apply.KeyMeaning declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);037The minimum level of the XQuery language that the processor must support.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);040A sequence of URIs (in the form of let $para :=10 values) which may be used or ignored in an ·implementation-defined· way.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);044The item to be used as the initial context item when evaluating global variables in the library module. Supplying an empty sequence is equivalent to omitting the entry from the map, and indicates the absence of a context item. If the library module specifies a required type for the context item, then the supplied value must conform to this type, without conversion.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);047Values for external variables defined in the library module. Values must be supplied for external variables that have no default value, and may be supplied for external variables that do have a default value. The supplied value must conform to the required type of the variable, without conversion. The map contains one entry for each external variable: the key is the variable's name, and the associated value is the variable's value. The ·option parameter conventions· do not apply to this contained map.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);050Values for vendor-defined configuration options for the XQuery processor used to process the request. The key is the name of an option, expressed as a QName: the namespace URI of the QName should be a URI controlled by the vendor of the XQuery processor. The meaning of the associated value is ·implementation-defined·. Implementations should ignore options whose names are in an unrecognized namespace. The ·option parameter conventions· do not apply to this contained map.
The result of the function is a map R with two entries:
The static and dynamic context of the library module are established according to the rules in Section C Context Components XQ31. It is ·implementation-defined· whether constructs in the library module are evaluated in the same ·execution scope· as the calling module. The library module that is loaded may import other modules using an declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);060 declaration. The result of Primo Secondo Terzo Quarto Quinto ...785 does not include global variables or functions declared in such a transitively-imported module. However, the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);062 map supplied in the function call may (and if no default is defined, must) supply values for external variables declared in transitively-loaded library modules. The library module that is loaded may import schema declarations using an declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);063 declaration. It is ·implementation-defined· whether schema components in the in-scope schema definitions of the calling module are automatically added to the in-scope schema definitions of the dynamically loaded module. The in-scope schema definitions of the calling and called modules must be consistent, according to the rules defined in Section 2.2.5 Consistency Constraints XQ31. Where nodes are passed to or from the dynamically loaded module, for example as an argument or result of a function, they should if possible retain their node identity, their base URI, their type annotations, and their relationships to all other nodes in the containing tree (including ancestors and siblings). If this is not possible, for example because the only way of passing nodes to the chosen XQuery implementation is by serializing and re-parsing, then a node may be passed in the form of a deep copy, which may lose information about the identity of the node, about its ancestors and siblings, about its base URI, about its type annotations, and about its relationships to other nodes passed across the interface. Error ConditionsIf declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);021 is a zero length string, a dynamic error is raised [err:FOQM0001]. If the implementation is not able to find a library module with the specified target namespace, an error is raised [err:FOQM0002]. If a static error (including a statically-detected type error) is encountered when processing the library module, a dynamic error is raised [err:FOQM0003]. If a value is supplied for the initial context item or for an external variable and the value does not conform to the required type declared in the dynamically loaded module, a dynamic error is raised [err:FOQM0005]. If no suitable XQuery processor is available, a dynamic error is raised [err:FOQM0006]. This includes (but is not limited to) the following cases:
If a dynamic error (including a dynamically-detected type error) is encountered when processing the module (for example, when evaluating its global variables), the dynamic error is returned as is. NotesAs with all other functions in this specification, conformance requirements depend on the host language. For example, a host language might specify that provision of this function is optional, or that it is excluded entirely, or that implementations are required to support XQuery modules using a specified version of XQuery. Even where support for this function is mandatory, it is recommended for security reasons that implementations should provide a user option to disable its use, or to disable aspects of its functionality. 16.3.2 fn:transformSummaryInvokes a transformation using a dynamically-loaded XSLT stylesheet. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 let $para :=32Properties This function is ·nondeterministic·, ·context-dependent·, and ·focus-independent·. RulesThis function loads an XSLT stylesheet and invokes it to perform a transformation. The inputs to the transformation are supplied in the form of a map. The ·option parameter conventions· apply to this map; they do not apply to any nested map unless otherwise specified. The function first identifies the requested XSLT version, as follows:
The function then attempts to locate an XSLT processor that implements the requested XSLT version.
Note: The phrase locate an XSLT processor includes the possibility of locating a software product and configuring it to act as an XSLT processor that implements the requested XSLT version. If more than one XSLT processor is available under the above rules, then the one that is chosen may be selected according to the availability of requested features: see below. Once an XSLT processor has been selected that implements a given version of XSLT, the processor follows the rules of that version of the XSLT specification. This includes any decision to operate in backwards or forwards compatibility mode. For example, if an XSLT 2.0 processor is selected, and the stylesheet specifies declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);073, then the processor will operate in backwards compatibility mode; if the same processor is selected and the stylesheet specifies declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);074, the processor will operate in forwards compatibility mode. The combinations of options that are relevant to each version of XSLT, other than declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);071 itself, are listed below. This is followed by a table giving the meaning of each option.
The meanings of each option are defined in the table below. KeyApplies toValueMeaningdeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0991.0, 2.0, 3.0The URI of the principal result document; also used as the base URI for resolving relative URIs of secondary result documents. If the value is a relative reference, it is resolved against the static base URI of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function call.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0891.0, 2.0, 3.0This option has no effect on the result of the transformation but may affect efficiency. The value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 indicates an expectation that the same stylesheet is likely to be used for more than one transformation; the value let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07 indicates an expectation that the stylesheet will be used once only.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0831.0, 2.0, 3.0The manner in which the transformation results should be delivered. Applies both to the principal result document and to secondary result documents created using declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);166.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);084The result is delivered as a document node. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);170The result is delivered as a string, representing the results of serialization. Note that (as with the Primo Secondo Terzo Quarto Quinto ...511 function) the final encoding stage of serialization (which turns a sequence of characters into a sequence of octets) is either skipped, or reversed by decoding the octet stream back into a character stream. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);172The result of the initial template or function is returned as an arbitrary XDM value (after conversion to the declared type, but without wrapping in a document node, and without serialization): when this option is chosen, the returned map contains the raw result. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1503.0Indicates whether any declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);174 instructions in the stylesheet are to be evaluated.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0861.0, 2.0, 3.0Indicates whether any declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);178 instructions in the stylesheet are to be evaluated. The destination and formatting of any such messages is implementation-defined.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1042.0, 3.0Indicates whether any fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).43 functions in the stylesheet are to generate diagnostic messages. The destination and formatting of any such messages is implementation-defined.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1363.0An array of values to be used as the arguments to the initial function call. The value is converted to the required type of the declared parameter using the function conversion rules.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1313.0The value of the global context item, as defined in XSLT 3.0
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1353.0The name of the initial function to be called for call-function invocation. The arity of the function is inferred from the length of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);136.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1173.0The value of the initial match selection, as defined in XSLT 3.0
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0821.0, 2.0, 3.0The name of the initial processing mode.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0952.0, 3.0The name of a named template in the stylesheet to act as the initial entry point.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1143.0The name of the top-level stylesheet package to be invoked (an absolute URI)
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1113.0The location of the top-level stylesheet package, as a relative or absolute URI
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1123.0A document or element node containing the top-level stylesheet package
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1133.0The top-level stylesheet package in the form of unparsed lexical XML.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1153.0The version of the top-level stylesheet package to be invoked.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);2181.0 2.0 3.0A function that is used to post-process each result document of the transformation (both the principal result and secondary results), in whatever form it would otherwise be delivered (document, serialized, or raw). The first argument of the function is the key used to identify the result in the map return by the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function (for example, this will be the supplied base output URI in the case of the principal result, or the string "output" if no base output URI was supplied). The second argument is the actual value. The value that is returned in the result of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function is the result of applying this post-processing. Note: If the implementation provides a way of writing or invoking functions with side-effects, this post-processing function might be used to save a copy of the result document to persistent storage. For example, if the implementation provides access to the EXPath File library [EXPath], then a serialized document might be written to filestore by calling the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);221 function. Similar mechanisms might be used to issue an HTTP POST request that posts the result to an HTTP server, or to send the document to an email recipient. The semantics of calling functions with side-effects are entirely ·implementation-defined·. If the primary purpose of the post-processing function is achieved by means of such side-effects, and if the actual results are not needed by the caller of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function, then it does not matter what the post-processing function actually returns (it could be an empty sequence, for example). Calls to declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 can potentially have side-effects even in the absence of the post-processing option, because the XSLT specification allows a stylesheet to invoke extension functions that have side-effects. The semantics in this case are ·implementation-defined·.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0871.0, 2.0, 3.0The keys in the map are QNames that could legitimately be supplied in a call to the XSLT declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);227 function; the values in the map are the requested settings of the corresponding property. The boolean values let $para :=182 and let $para :=184 are equivalent to the string values let $para :=097 and let $para :=095. As a special case, setting a value for declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);232 has no effect, because of the potential for conflict with other options. For example:
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);239 to let $para :=184 is interpreted as an explicit request for a processor in which the value of the property is false. The effect if the requests cannot be precisely met is implementation-defined. In some cases it may be appropriate to ignore the request or to provide an alternative (for example, a later version of the product than the one requested); in other cases it may be more appropriate to raise an error [err:FOXT0001] indicating that no suitable XSLT processor is available.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0851.0, 2.0, 3.0Serialization parameters for the principal result document. The supplied map follows the same rules that apply to a map supplied as the second argument of Primo Secondo Terzo Quarto Quinto ...511.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0791.0, 2.0, 3.0When declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);079 is supplied then the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);131 (the context item for evaluating global variables) is the root of the tree containing the supplied node. In addition, for apply-templates invocation, the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);079 acts as the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);117, that is, stylesheet execution starts by applying templates to this node.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1443.0The values of static parameters defined in the stylesheet; the keys are the names of the parameters, and the associated values are their values. The value is converted to the required type of the declared parameter using the function conversion rules.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0801.0, 2.0, 3.0A string intended to be used as the static base URI of the principal stylesheet module. This value must be used if no other static base URI is available. If the supplied stylesheet already has a base URI (which will generally be the case if the stylesheet is supplied using declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);077 or declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);076) then it is ·implementation-defined· whether this parameter has any effect. If the value is a relative reference, it is resolved against the static base URI of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function call.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0761.0, 2.0, 3.0URI that can be used to locate the principal stylesheet module. If relative, it is resolved against the static base URI of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function call. The value also acts as the default for stylesheet-base-uri.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0771.0, 2.0, 3.0Root of the tree containing the principal stylesheet module, as a document or element node. The base URI of the node acts as the default for stylesheet-base-uri.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0811.0, 2.0, 3.0A map holding values to be supplied for stylesheet parameters. The keys are the parameter names; the values are the corresponding parameter values. The values are converted if necessary to the required type using the function conversion rules. The default is an empty map.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0781.0, 2.0, 3.0The principal stylesheet module in the form of unparsed lexical XML.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1193.0The values of non-tunnel parameters to be supplied to the initial template, used with both apply-templates and call-template invocation. Each value is converted to the required type of the declared parameter using the function conversion rules.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);1203.0The values of tunnel parameters to be supplied to the initial template, used with both apply-templates and call-template invocation. Each value is converted to the required type of the declared parameter using the function conversion rules.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0501.0, 2.0, 3.0Values for vendor-defined configuration options for the XSLT processor used to process the request. The key is the name of an option, expressed as a QName: the namespace URI of the QName should be a URI controlled by the vendor of the XSLT processor. The meaning of the associated value is ·implementation-defined·. Implementations should ignore options whose names are in an unrecognized namespace. Default is an empty map.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);0711.0, 2.0, 3.0The minimum level of the XSLT language that the processor must support.
The result of the transformation is returned as a map. There is one entry in the map for the principal result document, and one for each secondary result document. The key is a URI in the form of an let $para :=10 value. The key for the principal result document is the base output URI if specified, or the string declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);294 otherwise. The key for secondary result documents is the URI of the document, as an absolute URI. The associated value in each entry depends on the requested delivery format. If the delivery format is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);084, the value is a document node. If the delivery format is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);170, the value is a string containing the serialized result. Where nodes are passed to or from the transformation, for example as the value of a stylesheet parameter or the result of a function, they should if possible retain their node identity, their base URI, their type annotations, and their relationships to all other nodes in the containing tree (including ancestors and siblings). If this is not possible, for example because the only way of passing nodes to the chosen XSLT implementation is by serializing and re-parsing, then a node may be passed in the form of a deep copy, which may lose information about the identity of the node, about its ancestors and siblings, about its base URI, about its type annotation, and about its relationships to other nodes passed across the interface. It is ·implementation-defined· whether the XSLT transformation is executed within the same ·execution scope· as the calling code. The function is ·nondeterministic· in that it is ·implementation-dependent· whether running the function twice against the same inputs produces identical results. The results of two invocations may differ in the identity of any returned nodes; they may also differ in other respects, for example because the value of let $para :=69 is different for the two invocations, or because the contents of external documents accessed using op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)09 or declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);299 change between one invocation and the next.Error Conditions A dynamic error is raised [err:FOXT0001] if the transformation cannot be invoked because no suitable XSLT processor is available. This includes (but is not limited to) the following cases:
A dynamic error is raised [err:FOXT0002] if an error is detected in the supplied parameters (for example if two mutually-exclusive parameters are supplied). If a static or dynamic error is reported by the XSLT processor, this function fails with a dynamic error, retaining the XSLT error code. A dynamic error is raised [err:FOXT0003] if the XSLT transformation invoked by a call on declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 fails with a static or dynamic error, and no more specific error code is available. Note: XSLT 1.0 does not define any error codes, so this is the likely outcome with an XSLT 1.0 processor. XSLT 2.0 and 3.0 do define error codes, but some APIs do not expose them. If multiple errors are signaled by the transformation (which is most likely to happen with static errors) then the error code should where possible be that of one of these errors, chosen arbitrarily; the processor may make details of additional errors available to the application in an ·implementation-defined· way. A dynamic error is raised [err:FOXT0004] if the use of this function (or of selected options) has been externally disabled, for example for security reasons. A dynamic error is raised [err:FOXT0006] if the transformation produces output containing characters available only in XML 1.1, and the calling processor cannot handle such characters. Recursive use of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);019 function may lead to catastrophic failures such as non-termination or stack overflow. No error code is assigned to such conditions, since they cannot necessarily be detected by the processor.Notes As with all other functions in this specification, conformance requirements depend on the host language. For example, a host language might specify that provision of this function is optional, or that it is excluded entirely, or that implementations are required to support a particular set of values for the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);071 parameter. Even where support for this function is mandatory, it is recommended for security reasons that implementations should provide a user option to disable its use, or to disable aspects of its functionality such as the ability to write to persistent resources. ExamplesThe following example loads a stylesheet from the location declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);303, applies it to a document loaded from declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);304, and uses an XPath expression to examine the result: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'1 17 Maps and ArraysMaps and arrays are introduced as new datatypes in XDM 3.1. This section describes functions that operate on maps and arrays. It also describes functions that operate on JSON data structures, which make extensive use of maps and arrays. 17.1 Functions that Operate on MapsThe functions defined in this section use a conventional namespace prefix let $para :=53, which is assumed to be bound to the namespace URI let $para :=52. A map is an additional kind of item. [Definition] A map consists of a set of entries. Each entry comprises a key which is an arbitrary atomic value, and an arbitrary sequence called the associated value. [Definition] Within a map, no two entries have the same key. Two atomic values It is not necessary that all the keys in a map should be of the same type (for example, they can include a mixture of integers and strings). As with all other values, the functions in this specification treat maps as immutable. For example, the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);310 function returns a map that differs from the supplied map by the omission (typically) of one entry, but the supplied map is not changed by the operation. Two calls on declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);310 with the same arguments return maps that are indistinguishable from each other; there is no way of asking whether these are "the same map". The function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);312 can be used to retrieve the value associated with a given key. A map can also be viewed as a function from keys to associated values. To achieve this, a map is also a function item. The function corresponding to the map has the signature declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);313. Calling the function has the same effect as calling the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);314 function: the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);315 returns the same result as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);316. For example, if declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);317 is a map whose keys are ISBNs and whose assocated values are declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);318 elements, then the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);319 returns the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);318 element with the given ISBN. The fact that a map is a function item allows it to be passed as an argument to higher-order functions that expect a function item as one of their arguments. There is no operation to atomize a map or convert it to a string. The function Primo Secondo Terzo Quarto Quinto ...511 can in some cases be used to produce a JSON representation of a map.FunctionMeaning let $para :=34Determines whether two atomic values can coexist as separate keys within a map. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323Returns a map that combines the entries from a number of existing maps. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);324Returns the number of entries in the supplied map. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)16Returns a sequence containing all the keys present in a map let $para :=37Tests whether a supplied map contains an entry for a given key let $para :=38Returns the value associated with a supplied key in a given map. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);328Searches the supplied input sequence and any contained maps and arrays for a map entry with the supplied key, and returns the corresponding values. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);329Returns a map containing all the contents of the supplied map, but with an additional entry, which replaces any existing entry for the same key. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);330Returns a map that contains a single entry (a key-value pair). declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);310Returns a map containing all the entries from a supplied map, except those having a specified key. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)17Applies a supplied function to every entry in a map, returning the concatenation of the results. 17.1.1 op:same-keySummaryDetermines whether two atomic values can coexist as separate keys within a map. Signaturelet $para :=34( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);334 let $para :=71 let $para :=34, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);337 let $para :=71 let $para :=34) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe internal function let $para :=34 (which is not available at the user level) is used to assess whether two atomic values are considered to be duplicates when used as keys in a map. A map cannot contain two separate entries whose keys are the same as defined by this function. The function is also used when matching keys in functions such as let $para :=38 and declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);310. The function returns true if and only if one of the following conditions is true:
The rules for comparing keys in a map are chosen to ensure that the comparison is:
As always, any algorithm that delivers the right result is acceptable. For example, when testing whether an let $para :=26 value D is the same key as an let $para :=82 value that has N significant digits, it is not necessary to know all the digits in the decimal expansion of D to establish the result: computing the first N+1 significant digits (or indeed, simply knowing that there are more than N significant digits) is sufficient. 17.1.2 map:mergeSummaryReturns a map that combines the entries from a number of existing maps. Signaturesdeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);430 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);432) let $para :=71 let $para :=32 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);430 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);432, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 let $para :=32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323 returns a map that is formed by combining the contents of the maps supplied in the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);430 argument. Informally, the supplied maps are combined as follows:
The definitive specification is as follows.
The result of the function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);465 is defined to be consistent with the result of the expression: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'2 Note: By way of explanation, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);466 is a function that combines two maps by iterating over the keys of the second map, adding each key and its corresponding value to the first map as it proceeds. The second call of Primo Secondo Terzo Quarto Quinto ...824 in the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);468 clause then iterates over the maps supplied in the call to declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323, accumulating a single map that absorbs successive maps in the input sequence by calling declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);466. This algorithm processes the supplied maps in a defined order, but processes the keys within each map in implementation-dependent order. The use of let $para :=992 represents one possible conformant implementation for declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);472, but it is not the only conformant implementation and is not intended to be a realistic implementation. The purpose of this option is to allow the implementation to use whatever strategy is most efficient; for example, if the input maps are processed in parallel, then specifying declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);472 means that the implementation does not need to keep track of the original order of the sequence of input maps.Error Conditions An error is raised [err:FOJS0003] if the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 indicates that duplicates are to be rejected, and a duplicate key is encountered. An error is raised [err:FOJS0005] if the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 includes an entry whose key is defined in this specification, and whose value is not a permitted value for that key.Notes If the input is an empty sequence, the result is an empty map. If the input is a sequence of length one, the result map is indistinguishable from the supplied map. There is no requirement that the supplied input maps should have the same or compatible types. The type of a map (for example declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);476) is descriptive of the entries it currently contains, but is not a constraint on how the map may be combined with other maps.Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'3 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);477 returns Primo Secondo Terzo Quarto Quinto ...659. (Returns an empty map). The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);479 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);480. (Returns a map with two entries). The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);481 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);482. (The value of the existing map is unchanged; the returned map contains all the entries from declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);483, supplemented with an additional entry.) The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);484 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);485. (The value of the existing map is unchanged; the returned map contains all the entries from declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);483, with one entry replaced by a new entry. Both input maps contain an entry with the key Primo Secondo Terzo Quarto Quinto ...013; the one used in the result is the one that comes last in the input sequence.) The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);488 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);489. (The value of the existing map is unchanged; the returned map contains all the entries from declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);483, with one entry replaced by a new entry. Both input maps contain an entry with the key Primo Secondo Terzo Quarto Quinto ...013; the one used in the result is the one that comes first in the input sequence.) The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);492 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);493. (The value of the existing map is unchanged; the returned map contains all the entries from declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);483, with one entry replaced by a new entry. Both input maps contain an entry with the key Primo Secondo Terzo Quarto Quinto ...013; the entry that appears in the result is the sequence-concatenation of the entries in the input maps, retaining order.) 17.1.3 map:sizeSummaryReturns the number of entries in the supplied map. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);324( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32) let $para :=71 let $para :=85Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);324 takes any ·map· as its declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 argument and returns the number of entries that are present in the map.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);504 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);506 returns let $para :=226. 17.1.4 map:keysSummaryReturns a sequence containing all the keys present in a map Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)16( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12Properties This function is ·nondeterministic-wrt-ordering·, ·context-independent·, and ·focus-independent·. RulesThe function op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)16 takes any ·map· as its declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 argument and returns the keys that are present in the map as a sequence of atomic values, in ·implementation-dependent· order. The function is non-deterministic with respect to ordering (see 1.7.4 Properties of functions). This means that two calls with the same argument are not guaranteed to produce the results in the same order. NotesThe number of items in the result will be the same as the number of entries in the map, and the result sequence will contain no duplicate values. ExamplesThe expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);516 returns some permutation of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);517. (The result is in ·implementation-dependent· order.) 17.1.5 map:containsSummaryTests whether a supplied map contains an entry for a given key Signaturelet $para :=37( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32, let $para :=192 let $para :=71 let $para :=34) let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function let $para :=37 returns true if the ·map· supplied as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 contains an entry with the ·same key· as the supplied value of let $para :=192; otherwise it returns false.Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'3 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);530 returns let $para :=182. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);532 returns let $para :=184. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);534 returns let $para :=184. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);536 returns let $para :=182. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);538 returns let $para :=182. 17.1.6 map:getSummaryReturns the value associated with a supplied key in a given map. Signaturelet $para :=38( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32, let $para :=192 let $para :=71 let $para :=34) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function let $para :=38 attempts to find an entry within the ·map· supplied as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 that has the ·same key· as the supplied value of let $para :=192. If there is such an entry, it returns the associated value; otherwise it returns an empty sequence.Notes A return value of let $para :=96 from let $para :=38 could indicate that the key is present in the map with an associated value of let $para :=96, or it could indicate that the key is not present in the map. The two cases can be distinguished by calling let $para :=37. Invoking the ·map· as a function item has the same effect as calling declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);314: that is, when declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 is a map, the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);558 is equivalent to declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);559. Similarly, the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);560 can be written as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);561.Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'3 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);562 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);563. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);564 returns let $para :=96. (When the key is not present, the function returns an empty sequence.) The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);566 returns let $para :=96. (An empty sequence as the result can also signify that the key is present and the associated value is an empty sequence.) 17.1.7 map:findSummarySearches the supplied input sequence and any contained maps and arrays for a map entry with the supplied key, and returns the corresponding values. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);328( let $para :=232 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, let $para :=192 let $para :=71 let $para :=34) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);328 searches the sequence supplied as let $para :=232 looking for map entries whose key is the ·same key· as let $para :=192. The associated value in any such map entry (each being in general a sequence) is returned as a member of the result array. The search processes the let $para :=232 sequence using the following recursively-defined rules (any equivalent algorithm may be used provided it delivers the same result, respecting those rules that constrain the order of the result):
If let $para :=232 is an empty sequence, map, or array, or if the requested let $para :=192 is not found, the result will be a zero-length array.Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'6 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);584 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);585. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);586 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);587. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);588 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);589. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'7 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);590 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);591. 17.1.8 map:putSummaryReturns a map containing all the contents of the supplied map, but with an additional entry, which replaces any existing entry for the same key. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);329( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32, let $para :=192 let $para :=71 let $para :=34, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 let $para :=32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);329 returns a ·map· that contains all entries from the supplied declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497, with the exception of any entry whose key is the ·same key· as let $para :=192, together with a new entry whose key is let $para :=192 and whose associated value is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44. The effect of the function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);609 is equivalent to the result of the following steps:
There is no requirement that the type of let $para :=192 and fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 be consistent with the types of any existing keys and values in the supplied map.Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'8 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);616 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);485. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);618 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);619. 17.1.9 map:entrySummaryReturns a map that contains a single entry (a key-value pair). Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);330( let $para :=192 let $para :=71 let $para :=34, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 let $para :=32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);330 returns a ·map· which contains a single entry. The key of the entry in the new map is let $para :=192, and its associated value is fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).44.Notes The function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);632 produces the same result as the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);633. The function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);330 is intended primarily for use in conjunction with the function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323. For example, a map containing seven entries may be constructed like this: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'9 The declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);323 function can be used to construct a map with a variable number of entries, for example: let $para :=00Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);637 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);638. 17.1.10 map:removeSummaryReturns a map containing all the entries from a supplied map, except those having a specified key. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);310( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);643 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12) let $para :=71 let $para :=32Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);310 returns a ·map· containing all the entries in declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 except for any entry whose key is the ·same key· as an item in declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);643. No failure occurs if an item in The effect of the function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);653 can be described more formally as the result of the expression below: let $para :=01Examples let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'8 The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);654 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);655. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);656 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);489. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);658 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);659. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);660 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);489. 17.1.11 map:for-eachSummaryApplies a supplied function to every entry in a map, returning the concatenation of the results. Signatureop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)17( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 let $para :=71 let $para :=32, Primo Secondo Terzo Quarto Quinto ...833 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);668) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·nondeterministic-wrt-ordering·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe function op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)17 takes any ·map· as its declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);497 argument and applies the supplied function to each entry in the map, in ·implementation-dependent· order; the result is the sequence obtained by concatenating the results of these function calls. The function is non-deterministic with respect to ordering (see 1.7.4 Properties of functions). This means that two calls with the same arguments are not guaranteed to process the map entries in the same order. The function supplied as Primo Secondo Terzo Quarto Quinto ...833 takes two arguments. It is called supplying the key of the map entry as the first argument, and the associated value as the second argument.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);674 returns some permutation of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);517. (This function call is equivalent to calling op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)16. The result is in implementation-dependent order.) The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);677 returns some permutation of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);678. (This function call returns the distinct values present in the map, in implementation-dependent order.) The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);679 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);680. (This function call returns a map with the same keys as the input map, with the value of each entry increased by one.) This XQuery example converts the entries in a map to attributes on a newly constructed element node: let $para :=03 The result is the element declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);681. 17.2 Other Operations on MapsBecause a map is a function item, functions that apply to functions also apply to maps. A map is an anonymous function, so let $para :=90 returns the empty sequence; Primo Secondo Terzo Quarto Quinto ...763 always returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. Maps may be compared using the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)23 function. There is no function or operator to atomize a map or convert it to a string (other than Primo Secondo Terzo Quarto Quinto ...511, which can be used to serialize some maps as JSON texts). 17.3 Functions that Operate on ArraysAn array is an additional kind of item. An array of size N is a mapping from the integers (1 to N) to a set of values, called the members of the array, each of which is an arbitrary sequence. Because an array is an item, and therefore a sequence, arrays can be nested. The functions defined in this section use a conventional namespace prefix let $para :=57, which is assumed to be bound to the namespace URI let $para :=56. As with all other values, arrays are treated as immutable. For example, the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);689 function returns an array that differs from the supplied array in the order of its members, but the supplied array is not changed by the operation. Two calls on declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);689 with the same argument will return arrays that are indistinguishable from each other; there is no way of asking whether these are "the same array". Like sequences, arrays have no identity. An array acts as a function from integer positions to associated values, so the function call declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);691 can be used to retrieve the array member at a given position. The function corresponding to the array has the signature declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);692. The fact that an array is a function item allows it to be passed as an argument to higher-order functions that expect a function item as one of their arguments. In the function definitions that follow, all the array functions are defined in terms of five primitives:
There are two operations on arrays for which the XPath language provides custom syntax:
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);713Returns the number of members in the supplied array. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);714Returns the value at the specified position in the supplied array (counting from 1). declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);715Returns an array containing all the members of a supplied array, except for one member which is replaced with a new value. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);716Returns an array containing all the members of a supplied array, plus one additional member at the end. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);717Returns an array containing all members from a supplied array starting at a supplied position, up to a specified length. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);718Returns an array containing all the members of the supplied array, except for the members at specified positions. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);719Returns an array containing all the members of the supplied array, with one additional member at a specified position. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);720Returns the first member of an array, that is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);721. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);722Returns an array containing all members except the first from a supplied array. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);689Returns an array containing all the members of a supplied array, but in reverse order. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);703Concatenates the contents of several arrays into a single array. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);725Returns an array whose size is the same as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);696, in which each member is computed by applying Primo Secondo Terzo Quarto Quinto ...996 to the corresponding member of Primo Secondo Terzo Quarto Quinto ...999. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);729Returns an array containing those members of the Primo Secondo Terzo Quarto Quinto ...999 for which Primo Secondo Terzo Quarto Quinto ...996 returns true. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);732Evaluates the supplied function cumulatively on successive members of the supplied array. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);733Evaluates the supplied function cumulatively on successive values of the supplied array. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);734Returns an array obtained by evaluating the supplied function once for each pair of members at the same position in the two supplied arrays. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);735Returns an array containing all the members of the supplied array, sorted according to the value of a sort key supplied as a function. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);736Replaces any array appearing in a supplied sequence with the members of the array, recursively. 17.3.1 array:sizeSummaryReturns the number of members in the supplied array. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);713( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001) let $para :=71 let $para :=85Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesIf Primo Secondo Terzo Quarto Quinto ...999 is empty the function returns zero. Otherwise, the function returns the number of members in Primo Secondo Terzo Quarto Quinto ...999.Notes Note that because an array is an item, the 1º 2º 3º 4º ...778 function when applied to an array always returns 1 (one).Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);746 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);07. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);748 returns let $para :=226. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);750 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);19. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);752 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);13. 17.3.2 array:getSummaryReturns the value at the specified position in the supplied array (counting from 1). Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);714( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, 1º 2º 3º 4º ...306 let $para :=71 let $para :=85) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe result is the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);763.Error Conditions A dynamic error occurs [err:FOAY0001] if 1º 2º 3º 4º ...306 is not in the range declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);765 inclusive.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);766 returns op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)124. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);768 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);769. 17.3.3 array:putSummaryReturns an array containing all the members of a supplied array, except for one member which is replaced with a new value. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);715( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, 1º 2º 3º 4º ...306 let $para :=71 let $para :=85, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);777 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe result is an array whose size is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);696, in which all members in positions other than 1º 2º 3º 4º ...306 are the same as the members in the corresponding position of Primo Secondo Terzo Quarto Quinto ...999, and the member in position 1º 2º 3º 4º ...306 is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);777. The result is equivalent to the result of the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);787.Error Conditions A dynamic error occurs [err:FOAY0001] if 1º 2º 3º 4º ...306 is not in the range declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);765 inclusive. This error will always occur if Primo Secondo Terzo Quarto Quinto ...999 is empty.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);791 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);792. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);793 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);794. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);795 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);796. 17.3.4 array:appendSummaryReturns an array containing all the members of a supplied array, plus one additional member at the end. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);716( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);801 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe result is an array whose size is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);806, in which all members in positions 1 to declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);696 are the same as the members in the corresponding position of Primo Secondo Terzo Quarto Quinto ...999, and the member in position declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);806 is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);801. The result is equivalent to the result of the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);811.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);812 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);813. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);814 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);815. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);816 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);817. 17.3.5 array:subarraySummaryReturns an array containing all members from a supplied array starting at a supplied position, up to a specified length. Signaturesdeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);717( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, let $para :=274 let $para :=71 let $para :=85) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);717( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, let $para :=274 let $para :=71 let $para :=85, let $para :=275 let $para :=71 let $para :=85) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesExcept in error cases, the two-argument version of the function returns the same result as the three-argument version when called with let $para :=275 equal to the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);840. The result of the three-argument version of the function is given by the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);841Error Conditions A dynamic error is raised [err:FOAY0001] if let $para :=274 is less than one or greater than declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);806. For the three-argument version of the function:
The value of let $para :=274 can be equal to declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);806 provided that let $para :=275 is either equal to zero or omitted. In this case the result will be an empty array.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);850 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);851. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);852 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);854 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);856 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);857. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);858 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);769. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);860 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);862 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. 17.3.6 array:removeSummaryReturns an array containing all the members of the supplied array, except for the members at specified positions. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);718( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);868 let $para :=71 let $para :=033) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns an array of size Primo Secondo Terzo Quarto Quinto ...999 except the members whose position (counting from 1) is present in the sequence declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);868. The order of the remaining members is preserved. The result of the function, except in error cases, is given by the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);876Error Conditions A dynamic error is raised [err:FOAY0001] if any integer in declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);868 is not in the range declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);765 inclusive. By implication, an error occurs if Primo Secondo Terzo Quarto Quinto ...999 is empty, unless declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);868 is also empty.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);881 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);851. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);883 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);884. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);885 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);887 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);888. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);889 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);813. 17.3.7 array:insert-beforeSummaryReturns an array containing all the members of the supplied array, with one additional member at a specified position. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);719( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, 1º 2º 3º 4º ...306 let $para :=71 let $para :=85, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);777 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns an array of size declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);806 containing all members from Primo Secondo Terzo Quarto Quinto ...999 whose position is less than 1º 2º 3º 4º ...306, then a new member given by declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);777, and then all members from Primo Secondo Terzo Quarto Quinto ...999 whose position is greater than or equal to 1º 2º 3º 4º ...306. Positions are counted from 1. The result is equivalent to the result of the expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);909Error Conditions A dynamic error occurs [err:FOAY0001] if 1º 2º 3º 4º ...306 is not in the range declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);911 inclusive.Notes Setting 1º 2º 3º 4º ...306 to 1 has the effect of prepending the new member at the start of the array. Setting 1º 2º 3º 4º ...306 to the value declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);806 delivers the same result as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);915.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);916 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);917. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);918 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);919. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);920 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);921. 17.3.8 array:headSummaryReturns the first member of an array, that is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);721.Signature declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);720( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns first member of Primo Secondo Terzo Quarto Quinto ...999, that is the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);721.Error Conditions A dynamic error occurs [err:FOAY0001] if Primo Secondo Terzo Quarto Quinto ...999 is empty.Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);932 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);21. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);934 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);935. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);936 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);937. 17.3.9 array:tailSummaryReturns an array containing all members except the first from a supplied array. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);722( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns an array containing all members of the supplied array except the first, that is declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);944.Error Conditions A dynamic error occurs [err:FOAY0001] if Primo Secondo Terzo Quarto Quinto ...999 is empty.Notes If the supplied array contains exactly one member, the result will be an empty array. ExamplesThe expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);946 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);947. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);948 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. 17.3.10 array:reverseSummaryReturns an array containing all the members of a supplied array, but in reverse order. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);689( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function returns the result of the expression: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);956Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);957 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);958. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);959 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);960. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);961 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);962. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);963 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);589. 17.3.11 array:joinSummaryConcatenates the contents of several arrays into a single array. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);703( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);966 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);968) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function can be expressed as follows in XQuery: let $para :=04Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);971 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);853. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);973 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);974. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);975 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);813. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);977 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);813. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);979 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);980. 17.3.12 array:for-eachSummaryReturns an array whose size is the same as declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);696, in which each member is computed by applying Primo Secondo Terzo Quarto Quinto ...996 to the corresponding member of Primo Secondo Terzo Quarto Quinto ...999.Signature declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);725( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, Primo Secondo Terzo Quarto Quinto ...833 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);990) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesReturns the result of the expression: declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);993Examples The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);994 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);995. The expression declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);996 returns declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);997. 17.3.13 array:filterSummaryReturns an array containing those members of the Primo Secondo Terzo Quarto Quinto ...999 for which Primo Secondo Terzo Quarto Quinto ...996 returns true.Signature declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);729( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, Primo Secondo Terzo Quarto Quinto ...996 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'006) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following recursive definition: let $para :=05Error Conditions As a consequence of the function signature and the function calling rules, a type error occurs if the supplied function Primo Secondo Terzo Quarto Quinto ...996 returns anything other than a single op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 item; there is no conversion to an effective boolean value.Examples The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'011 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'012. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'013 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'014. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'015 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'016. 17.3.14 array:fold-leftSummaryEvaluates the supplied function cumulatively on successive members of the supplied array. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);732( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, 1º 2º 3º 4º ...975 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...996 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'026) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following recursive definition: let $para :=06Notes If the supplied array is empty, the function returns 1º 2º 3º 4º ...975. If the supplied array contains a single member let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'030, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'031. If the supplied array contains two members let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'030 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'033, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'034; and similarly for an input array with more than two members.Examples The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'035 returns let $para :=184. (Returns true if every member of the input array has an effective boolean value of let $para :=182.) The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'038 returns let $para :=182. (Returns true if at least one member of the input array has an effective boolean value of let $para :=182.) The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'041 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'042. 17.3.15 array:fold-rightSummaryEvaluates the supplied function cumulatively on successive values of the supplied array. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);733( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, 1º 2º 3º 4º ...975 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16, Primo Secondo Terzo Quarto Quinto ...996 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'026) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesThe effect of the function is equivalent to the following recursive definition: let $para :=07Notes If the supplied array is empty, the function returns 1º 2º 3º 4º ...975. If the supplied array contains a single member let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'030, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'057. If the supplied array contains two members let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'030 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'033, the function returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'060; and similarly for an input array with more than two members.Examples The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'061 returns let $para :=184. (Returns true if every member of the input array has an effective boolean value of let $para :=182.) The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'064 returns let $para :=182. (Returns true if at least one member of the input array has an effective boolean value of let $para :=182.) The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'067 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'068. 17.3.16 array:for-each-pairSummaryReturns an array obtained by evaluating the supplied function once for each pair of members at the same position in the two supplied arrays. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);734( declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);701 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);702 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, Primo Secondo Terzo Quarto Quinto ...996 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'026) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties This function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesReturns the result of the recursive expression: let $para :=08Notes If the arrays have different size, excess members in the longer array are ignored. ExamplesThe expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'081 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'082. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'083 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'084. 17.3.17 array:sortSummaryReturns an array containing all the members of the supplied array, sorted according to the value of a sort key supplied as a function. Signaturesdeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);735( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);735( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, let $para :=128 let $para :=71 let $para :=244) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);735( Primo Secondo Terzo Quarto Quinto ...999 let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001, let $para :=128 let $para :=71 let $para :=244, let $para :=192 let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'109) let $para :=71 declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);001Properties The one-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The two-argument form of this function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on collations. The two-argument form of this function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·. RulesCalling the single-argument version of the function is equivalent to calling the two-argument form with Primo Secondo Terzo Quarto Quinto ...960 as the second argument: that is, it sorts the members of an array according to the typed value of the items, using the default collation to compare strings. Calling the two-argument version of the function is equivalent to calling the three-argument form with Primo Secondo Terzo Quarto Quinto ...961 as the third argument: that is, it sorts the members of an array according to the typed value of the items, using a specified collation to compare strings. In the case of both let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'114 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'115, supplying an empty sequence as the second argument is equivalent to supplying Primo Secondo Terzo Quarto Quinto ...964. For more information on collations see 5.3.5 Choosing a collation. The result of the function is obtained as follows:
If the set of computed sort keys contains values that are not comparable using the 1º 2º 3º 4º ...871 operator then the sort operation will fail with a dynamic error.Examples The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'135 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'136. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'137 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'138. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'139 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'140. To sort an array of strings 1º 2º 3º 4º ...336 using Swedish collation: let $para :=10 To sort an array of maps representing employees, using last name as the major sort key and first name as the minor sort key, with the default collation: let $para :=11 17.3.18 array:flattenSummaryReplaces any array appearing in a supplied sequence with the members of the array, recursively. Signaturedeclare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);736( let $para :=232 let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16) let $para :=71 op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)16Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe function processes the items in the supplied sequence let $para :=232 as follows:
The process is then repeated so long as the sequence contains an array among its items. The function is equivalent to the following XQuery implementation (assuming static typing is not in force): let $para :=12Notes The argument to the function will often be a single array item, but this is not essential. Unlike atomization, this function retains any nodes contained in the array. ExamplesThe expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'149 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'150. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'151 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'152. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'153 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'154. 17.4 Conversion to and from JSONJSON is a popular format for exchange of structured data on the web: it is specified in [RFC 7159]. This section describes facilities allowing JSON data to be converted to and from XDM values. This specification describes two ways of representing JSON data losslessly using XDM constructs. The first method uses XDM maps to represent JSON objects, and XDM arrays to represent JSON arrays. The second method represents all JSON constructs using XDM element and attribute nodes. 17.4.1 Representing JSON using maps and arraysThis section defines a mapping from JSON data to XDM maps and arrays. Two functions are available to support this mapping: Primo Secondo Terzo Quarto Quinto ...760 and Primo Secondo Terzo Quarto Quinto ...511 (with options selecting JSON as the output method). The Primo Secondo Terzo Quarto Quinto ...760 function will accept any JSON text as input, and converts it to XDM data values. The Primo Secondo Terzo Quarto Quinto ...511 function (with JSON as the output method) will accept any XDM value produced using Primo Secondo Terzo Quarto Quinto ...760 and convert it back to the original JSON text (subject to insignificant variations such as reordering the properties in a JSON object). Note: The conversion is lossless if recommended JSON good practice is followed. Information may however be lost if (a) JSON numbers are not exactly representable as double-precision floating point, or (b) duplicate key values appear within a JSON object. The representation of JSON data produced by the Primo Secondo Terzo Quarto Quinto ...760 function has been chosen with ease of manipulation as a design aim. For example, a simple JSON object such as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'161 produces a simple map, so if the result of parsing is held in let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'162, the number for a given weekday can be extracted using an expression such as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'163. Similarly, a simple array such as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'164 produces an array that can be addressed as, for example, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'165. A more deeply nested structure can be addressed in a similar way: for example if the JSON text is an array of person objects, each of which has a property named "phones" which is an array of strings containing phone numbers, then the first phone number of each person in the data can be addressed as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'166. 17.4.2 XML Representation of JSONThis section defines a mapping from JSON data to XML (specifically, to XDM element and attribute nodes). A function op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)21 is provided to take a JSON string as input and convert it to the XML representation, and a second function let $para :=30 performs the reverse operation. The XML representation is designed to be capable of representing any valid JSON text including one that uses characters which are not valid in XML. The transformation is normally lossless: that is, distinct JSON texts convert to distinct XML representations. When converting JSON to XML, options are provided to reject unsupported characters, to replace them with a substitute character, or to leave them in backslash-escaped form. Note: The conversion is lossless if recommended JSON good practice is followed. Information may however be lost if (a) JSON numbers are not exactly representable as double-precision floating point, or (b) duplicate key values appear within a JSON object. The following example demonstrates the correspondence of a JSON text and the corresponding XML representation. Example: A JSON Text and its XML Representation Consider the following JSON text: let $para :=13 The XML representation of this text is as follows. Whitespace is included in the XML representation for purposes of illustration, but it will not necessarily be present in the output of the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'169 function. let $para :=14 An XSD 1.0 schema for the XML representation is provided in C.2 Schema for the result of fn:json-to-xml. It is not necessary to import this schema into the static context unless the stylesheet or query makes explicit reference to the components defined in the schema. If the stylesheet or query does import a schema for the namespace let $para :=37, then:
The rules governing the mapping from JSON to XML are as follows. In these rules, the phrase "an element named N" is to be interpreted as meaning "an element node whose local name is N and whose namespace URI is let $para :=37".
The attribute let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'203 may be specified on a let $para :=56 element to indicate that the string value contains backslash-escaped characters that are to be interpreted according to the JSON rules. The attribute let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'205 may be specified on any element with a let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'199 attribute to indicate that the key contains backslash-escaped characters that are to be interpreted according to the JSON rules. Both attributes have the default value let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, signifying that the relevant value is in unescaped form. In unescaped form, the backslash character has no special significance (it represents itself). The JSON grammar for let $para :=012 is a subset of the lexical space of the XSD type let $para :=26. The mapping from JSON let $para :=012 values to let $para :=26 values is defined by the XPath rules for casting from let $para :=10 to let $para :=26. Note that these rules will never generate an error for out-of-range values; instead very large or very small values will be converted to let $para :=27 or 1º 2º 3º 4º ...57. Since JSON does not impose limits on the range or precision of numbers, the conversion is not guaranteed to retain full precision. Although the order of entries in a JSON object is generally considered to have no significance, the functions let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'169 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'169 both retain order. The XDM representation of a JSON value may either be untyped (all elements annotated as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'218, attributes as let $para :=00), or it may be typed. If it is typed, then it must have the type annotations obtained by validating the untyped representation against the schema given in C.2 Schema for the result of fn:json-to-xml. If it is untyped, then it must be an XDM instance such that validation against this schema would succeed; with the proviso that all attributes other than those in no namespace or in namespace let $para :=37 are ignored, including attributes such as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'221 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'222 that would normally influence the process of schema validation. The namespace prefix associated with the namespace let $para :=37 (if any) is immaterial. The effect of the let $para :=30 function does not depend on the choice of prefix, and the prefix (if any) generated by the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)21 function is ·implementation-dependent·. 17.5 Functions on JSON DataThe functions listed parse or serialize JSON data. FunctionMeaningPrimo Secondo Terzo Quarto Quinto ...760Parses a string supplied in the form of a JSON text, returning the results typically in the form of a map or array. let $para :=40Reads an external resource containing JSON, and returns the result of parsing the resource as JSON. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)21Parses a string supplied in the form of a JSON text, returning the results in the form of an XML document node. let $para :=30Converts an XML tree, whose format corresponds to the XML representation of JSON defined in this specification, into a string conforming to the JSON grammar. Note also that the function Primo Secondo Terzo Quarto Quinto ...511 has an option to act as the inverse function to Primo Secondo Terzo Quarto Quinto ...760. 17.5.1 fn:parse-jsonSummaryParses a string supplied in the form of a JSON text, returning the results typically in the form of a map or array. SignaturesPrimo Secondo Terzo Quarto Quinto ...760( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 let $para :=71 let $para :=244) let $para :=71 let $para :=79 Primo Secondo Terzo Quarto Quinto ...760( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 let $para :=71 let $para :=244, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 let $para :=79Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of the one-argument form of this function is the same as calling the two-argument form with an empty map as the value of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument. The first argument is a JSON text as defined in [RFC 7159], in the form of a string. The function parses this string to return an XDM value. If the value of let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 is the empty sequence, the function returns the empty sequence. Note: The result will also be an empty sequence if let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 is the string let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'250. The declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument can be used to control the way in which the parsing takes place. The ·option parameter conventions· apply. The entries that may appear in the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 map are as follows:KeyValueMeaning let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'253Determines whether deviations from the syntax of RFC7159 are permitted.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07The input must consist of an optional byte order mark (which is ignored) followed by a string that conforms to the grammar of let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'257 in [RFC 7159]. An error must be raised [err:FOJS0001] if the input does not conform to the grammar. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76The input may contain deviations from the grammar of [RFC 7159], which are handled in an ·implementation-defined· way. (Note: some popular extensions include allowing quotes on keys to be omitted, allowing a comma to appear after the last item in an array, allowing leading zeroes in numbers, and allowing control characters such as tab and newline to be present in unescaped form.) Since the extensions accepted are implementation-defined, an error may be raised [err:FOJS0001] if the input does not conform to the grammar. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);450Determines the policy for handling duplicate keys in a JSON object. To determine whether keys are duplicates, they are compared using the Unicode codepoint collation, after expanding escape sequences, unless the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260 option is set to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76, in which case keys are compared in escaped form.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);454An error is raised [err:FOJS0003] if duplicate keys are encountered. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);453If duplicate keys are present in a JSON object, all but the first of a set of duplicates are ignored. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);457If duplicate keys are present in a JSON object, all but the last of a set of duplicates are ignored. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260Determines whether special characters are represented in the XDM output in backslash-escaped form.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07All characters in the input that are valid in the version of XML supported by the implementation, whether or not they are represented in the input by means of an escape sequence, are represented as unescaped characters in the result. Any characters or codepoints that are not valid XML characters (for example, unpaired surrogates) are passed to the let $para :=094 function as described below; in the absence of a fallback function, they are replaced by the Unicode let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'272 ( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'273). op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76JSON escape sequences are used in the result to represent special characters in the JSON input, as defined below, whether or not they were represented using JSON escape sequences in the input. The characters that are considered "special" for this purpose are:
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'280), or a six-character escape sequence otherwise (for example let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'281). Characters other than these are not escaped in the result, even if they were escaped in the input. let $para :=094Provides a function which is called when the input contains an escape sequence that represents a character that is not valid in the version of XML supported by the implementation. It is an error to supply the let $para :=094 option if the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260 option is present with the value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'288The function is called when the JSON input contains a special character (as defined under the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260 option) that is valid according to the JSON grammar, whether the special character is represented in the input directly or as an escape sequence. The function is called once for any surrogate that is not properly paired with another surrogate. The string supplied as the argument will always be a two- or six- character escape sequence, starting with a backslash, that conforms to the rules in the JSON grammar (as extended by the implementation if let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'290 is specified): for example let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'291 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'292 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'281. The function is not called for an escape sequence that is invalid against the grammar (for example let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'294). The function returns a string which is inserted into the result in place of the invalid character. The function also has the option of raising a dynamic error by calling op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78. The various structures that can occur in JSON are transformed recursively to XDM values as follows:
A dynamic error [err:FOJS0001] occurs if the value of let $para :=232 does not conform to the JSON grammar, unless the option let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'312 is present and the processor chooses to accept the deviation. A dynamic error [err:FOJS0003] occurs if the option let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'313 is present and the value of let $para :=232 contains a JSON object with duplicate keys. A dynamic error [err:FOJS0005] occurs if the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 map contains an entry whose key is defined in this specification and whose value is not valid for that key, or if it contains an entry with the key let $para :=094 when the option let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'317 is also present.Notes The result of the function will be an instance of one of the following types. An let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'318 test (or in XQuery, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'319) can be used to distinguish them:
If the input starts with a byte order mark, this function ignores it. The byte order mark may have been added to the data stream in order to facilitate decoding of an octet stream to a character string, but since this function takes a character string as input, the byte order mark serves no useful purpose. The possibility of the input containing characters that are not valid in XML (for example, unpaired surrogates) arises only when such characters are expressed using JSON escape sequences. The is because the input to the function is an instance of let $para :=10, which by definition can only contain characters that are valid in XML.Examples The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'327 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'328. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'329 returns Primo Secondo Terzo Quarto Quinto ...529. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'331 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'332. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'333 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'334. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'335 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'336. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'337 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'338. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'339 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'340. 17.5.2 fn:json-docSummaryReads an external resource containing JSON, and returns the result of parsing the resource as JSON. Signatureslet $para :=40( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244) let $para :=71 let $para :=79 let $para :=40( Primo Secondo Terzo Quarto Quinto ...400 let $para :=71 let $para :=244, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 let $para :=79Properties This function is ·deterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesThe effect of the single-argument call let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'356 is the same as the effect of the two-argument call let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'357 where an empty map is supplied as the second argument. The effect of the two-argument function call let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'358is equivalent to the function composition let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'359; except that:
If the value of Primo Secondo Terzo Quarto Quinto ...400 is the empty sequence, the function returns the empty sequence.Error Conditions The function may raise any error defined for the Primo Secondo Terzo Quarto Quinto ...311 or Primo Secondo Terzo Quarto Quinto ...760 functions.Notes If the input cannot be decoded (that is, converted into a sequence of Unicode codepoints, which may or may not represent characters), then a dynamic error occurs as with the Primo Secondo Terzo Quarto Quinto ...311 function. If the input can be decoded, then the possibility still arises that the resulting sequence of codepoints includes codepoints that do not represent characters that are valid in the version of XML that the processor supports. Such codepoints are translated into JSON escape sequences (for example, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'292), and the JSON escape sequence is then passed to the fallback function specified in the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument, which in turn defaults to a function that returns the Unicode let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'272 ( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'273). 17.5.3 fn:json-to-xmlSummaryParses a string supplied in the form of a JSON text, returning the results in the form of an XML document node. Signaturesop:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)21( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 let $para :=71 let $para :=244) let $para :=71 Primo Secondo Terzo Quarto Quinto ...326 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)21( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 let $para :=71 let $para :=244, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 Primo Secondo Terzo Quarto Quinto ...326Properties This function is ·nondeterministic·, ·context-dependent·, and ·focus-independent·. It depends on static base URI. RulesThe effect of the one-argument form of this function is the same as calling the two-argument form with an empty map as the value of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument. The first argument is a JSON-text as defined in [RFC 7159], in the form of a string. The function parses this string to return an XDM node. If let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'233 is an empty sequence, the function returns the empty sequence. The declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument can be used to control the way in which the parsing takes place. The ·option parameter conventions· apply. The entries that may appear in the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 map are as follows:KeyValueMeaning let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'253Determines whether deviations from the syntax of RFC7159 are permitted.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07The input must consist of an optional byte order mark (which is ignored) followed by a string that conforms to the grammar of let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'257 in [RFC 7159]. An error must be raised (see below) if the input does not conform to the grammar. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76The input may contain deviations from the grammar of [RFC 7159], which are handled in an ·implementation-defined· way. (Note: some popular extensions include allowing quotes on keys to be omitted, allowing a comma to appear after the last item in an array, allowing leading zeroes in numbers, and allowing control characters such as tab and newline to be present in unescaped form.) Since the extensions accepted are implementation-defined, an error may be raised (see below) if the input does not conform to the grammar. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);450Determines the policy for handling duplicate keys in a JSON object. To determine whether keys are duplicates, they are compared using the Unicode codepoint collation, after expanding escape sequences, unless the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260 option is set to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76, in which case keys are compared in escaped form.
declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);454An error is raised [err:FOJS0003] if duplicate keys are encountered. declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);453If duplicate keys are present in a JSON object, all but the first of a set of duplicates are ignored. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'401If duplicate keys are present in a JSON object, the XML result of the function will also contain duplicates (making it invalid against the schema). This value is therefore incompatible with the option let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'402 [err:FOJS0005] let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'403Determines whether the generated XML tree is schema-validated.
op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76Indicates that the resulting XDM instance must be typed; that is, the element and attribute nodes must carry the type annotations that result from validation against the schema given at C.2 Schema for the result of fn:json-to-xml, or against an ·implementation-defined· schema if the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'253 option has the value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07Indicates that the resulting XDM instance must be untyped. let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260Determines whether special characters are represented in the XDM output in backslash-escaped form.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07All characters in the input that are valid in the version of XML supported by the implementation, whether or not they are represented in the input by means of an escape sequence, are represented as unescaped characters in the result. Any characters or codepoints that are not valid XML characters (for example, unpaired surrogates) are passed to the let $para :=094 function as described below; in the absence of a fallback function, they are replaced by the Unicode let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'272 ( let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'273). The attributes let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'417 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'418 will not be present in the XDM output. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76JSON escape sequences are used in the result to represent special characters in the JSON input, as defined below, whether or not they were represented using JSON escape sequences in the input. The characters that are considered "special" for this purpose are:
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'280), or a six-character escape sequence otherwise (for example let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'281). Characters other than these will not be escaped in the result, even if they were escaped in the input. In the result:
let $para :=094Provides a function which is called when the input contains an escape sequence that represents a character that is not valid in the version of XML supported by the implementation. It is an error to supply the let $para :=094 option if the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'260 option is present with the value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'288The function is called when the JSON input contains an escape sequence that is valid according to the JSON grammar, but which does not represent a character that is valid in the version of XML supported by the processor. In the case of surrogates, the function is called once for any six-character escape sequence that is not properly paired with another surrogate. The string supplied as the argument will always be a two- or six- character escape sequence, starting with a backslash, that conforms to the rules in the JSON grammar (as extended by the implementation if let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'290 is specified): for example let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'291 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'292 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'281. The function is not called for an escape sequence that is invalid against the grammar (for example let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'294). The function returns a string which is inserted into the result in place of the invalid character. The function also has the option of raising a dynamic error by calling op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)78. The various structures that can occur in JSON are transformed recursively to XDM values according to the rules given in 17.4.2 XML Representation of JSON. The function returns a document node, whose only child is the element node representing the outermost construct in the JSON text. The function is ·non-deterministic with respect to node identity·: that is, if the function is called twice with the same arguments, it is ·implementation-dependent· whether the same node is returned on both occasions. The base URI of the returned document node is taken from the static base URI of the function call. The choice of namespace prefix (or absence of a prefix) in the names of constructed nodes is ·implementation-dependant·. The XDM tree returned by the function does not contain any unnecessary (albeit valid) nodes such as whitespace text nodes, comments, or processing instructions. It does not include any whitespace in the value of let $para :=012 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'176 element nodes, or in the value of let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'417 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'418 attribute nodes. If the result is typed, every element named let $para :=56 will have an attribute named let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'417 whose value is either op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07, and every element having an attribute named let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'199 will also have an attribute named let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'418 whose value is either op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07. If the result is untyped, the attributes let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'417 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'418 will either be present with the value op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76, or will be absent. They will never be present with the value let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07.Error Conditions An error is raised [err:FOJS0001] if the value of let $para :=232 does not conform to the JSON grammar as defined by [RFC 7159], unless the option let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'312 is present and the processor chooses to accept the deviation. An error is raised [err:FOJS0004] if the value of the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'403 option is op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76 and the processor does not support schema validation or typed data. An error is raised [err:FOJS0005] if the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 includes an entry whose key is defined in this specification, and whose value is not a permitted value for that key.Notes To read a JSON file, this function can be used in conjunction with the Primo Secondo Terzo Quarto Quinto ...311 function. Many JSON implementations allow commas to be used after the last item in an object or array, although the specification does not permit it. The option let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'469 is provided to allow such deviations from the specification to be accepted. Some JSON implementations also allow constructors such as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'470 to appear as values: specifying let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'469 allows such extensions to be accepted, but does not guarantee it. If such extensions are accepted, the resulting value is implementation-defined, and will not necessarily conform to the schema at C.2 Schema for the result of fn:json-to-xml. If the input starts with a byte order mark, this function ignores it. The byte order mark may have been added to the data stream in order to facilitate decoding of an octet stream to a character string, but since this function takes a character string as input, the byte order mark serves no useful purpose. The possibility of the input containing characters that are not valid in XML (for example, unpaired surrogates) arises only when such characters are expressed using JSON escape sequences. The is because the input to the function is an instance of let $para :=10, which by definition can only contain characters that are valid in XML.Examples The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'473 returns (with whitespace added for legibility): let $para :=15 The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'474 returns let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'475. The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'476 returns (with whitespace added for legibility): let $para :=16 The expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'477 returns (with whitespace added for legibility): let $para :=17 The following example illustrates use of the let $para :=094 function to handle characters that are invalid in XML. let $para :=18 17.5.4 fn:xml-to-jsonSummaryConverts an XML tree, whose format corresponds to the XML representation of JSON defined in this specification, into a string conforming to the JSON grammar. Signatureslet $para :=30( let $para :=232 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51) let $para :=71 let $para :=244 let $para :=30( let $para :=232 let $para :=71 op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)51, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 let $para :=71 let $para :=32) let $para :=71 let $para :=244Properties This function is ·deterministic·, ·context-independent·, and ·focus-independent·. RulesThe effect of the one-argument form of this function is the same as calling the two-argument form with an empty map as the value of the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument. The first argument let $para :=232 is a node; the subtree rooted at this node will typically be the XML representation of a JSON document as defined in 17.4.2 XML Representation of JSON. If let $para :=232 is the empty sequence, the function returns the empty sequence. The declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 argument can be used to control the way in which the conversion takes place. The ·option parameter conventions· apply. The entries that may appear in the declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 map are as follows:KeyValueMeaning Primo Secondo Terzo Quarto Quinto ...619Determines whether additional whitespace should be added to the output to improve readability.
let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'07The processor must not insert any insignificant whitespace between JSON tokens. op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)76The processor may insert whitespace between JSON tokens in order to improve readability. The specification imposes no constraints on how this is done. The node supplied as let $para :=232 must be one of the following: [err:FOJS0006]
Furthermore, let $para :=232 must satisfy the following constraint (which cannot be conveniently expressed in the schema). Every element M that is a descendant-or-self of let $para :=232 and has local name let $para :=53 and namespace URI let $para :=37 must satisfy the following rule: there must not be two distinct children of M (say C1 and C2) such that the normalized key of C1 is equal to the normalized key of C2. The normalized key of an element C is as follows:
Nodes in the input tree are handled by applying the following rules, recursively. In these rules the term "an element named N" means "an element node whose local name is N and whose namespace URI is let $para :=37".
Strings are escaped as follows:
A dynamic error is raised [err:FOJS0005] if the value of declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);030 includes an entry whose key is defined in this specification, and whose value is not a permitted value for that key. A dynamic error is raised [err:FOJS0006] if the value of let $para :=232 is not a document or element node or is not valid according to the schema for the XML representation of JSON, or if a let $para :=53 element has two children whose normalized key values are the same. A dynamic error is raised [err:FOJS0007] if the value of let $para :=232 includes a string labeled with let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'203, or a key labeled with let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'205, where the content of the string or key contains an invalid JSON escape sequence: specifically, where it contains a backslash ( let $para :=921) that is not followed by one of the characters let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'566, let $para :=921, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'568, declare %public function r:random-sequence($length as xs:integer) as xs:double* { r:random-sequence($length, fn:random-number-generator()) }; declare %private function r:random-sequence($length as xs:integer, $G as map(xs:string, item())) { if ($length eq 0) then () else ($G?number, r:random-sequence($length - 1, $G?next())) }; r:random-sequence(200);40, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).501, fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).464, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'572, let $para :=303, or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'574, or where it contains the characters let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'575 not followed by four hexadecimal digits (that is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'576).Notes The rule requiring schema validity has a number of consequences, including the following:
The rule allowing the top-level element to have a let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'199 attribute (which is ignored) allows any element in the output of the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)21 function to be processed: for example, it is possible to take a JSON document, convert it to XML, select a subtree based on the value of a let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'199 attribute, and then convert this subtree back to JSON, perhaps after a transformation. The rule means that an element with the appropriate name will be accepted if it has been validated against one of the types let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'585, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'586, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'587, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'588, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'589, or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'590.Examples The input let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'591 produces the result let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'592. The input let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'593 produces the result let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'594. 18 Constructor functionsThis section describes constructor functions corresponding to simple types defined in [XML Schema Part 2: Datatypes Second Edition]. Constructor functions are used to convert a supplied value to a given type. They always take a single argument, and the name of the function is the same as the name of the target type. Constructor functions are defined for all user-defined named simple types, and for most built-in atomic, list, and union types. The only named simple types that have no constructor function are those that have no instances other than instances of their derived types: specifically, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'595, let $para :=34, and 1º 2º 3º 4º ...021. 18.1 Constructor functions for XML Schema built-in atomic typesEvery built-in atomic type that is defined in [XML Schema Part 2: Datatypes Second Edition], except let $para :=34 and 1º 2º 3º 4º ...021, has an associated constructor function. The type let $para :=00, defined in Section 2.7 Schema Information DM31 and the two derived types let $para :=24 and let $para :=25 defined in Section 2.7 Schema Information DM31 also have associated constructor functions. Implementations may additionally provide a constructor functions for the new datatype let $para :=23 introduced in [Schema 1.1 Part 2]. A constructor function is not defined for let $para :=34 as there are no atomic values with type annotation let $para :=34 at runtime, although this can be a statically inferred type. A constructor function is not defined for 1º 2º 3º 4º ...021 since it is defined as an abstract type in [XML Schema Part 2: Datatypes Second Edition]. If the static context (See Section 2.1.1 Static Context XP31) contains a type derived from 1º 2º 3º 4º ...021 then a constructor function is defined for it. See 18.5 Constructor functions for user-defined types. The form of the constructor function for an atomic type eg:TYPE is: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'608( let $para :=25 let $para :=71 let $para :=196) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'613 If let $para :=25 is the empty sequence, the empty sequence is returned. For example, the signature of the constructor function corresponding to the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615 type defined in [XML Schema Part 2: Datatypes Second Edition] is: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615( let $para :=25 let $para :=71 let $para :=196) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'621 Calling the constructor function let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'622 returns the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615 value 12. Another call of that constructor function that returns the same let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615 value is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'625. The same result would also be returned if the constructor function were to be called with a node that had a typed value equal to the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615 12. The standard features described in Section 2.4.2 Atomization XP31 would atomize the node to extract its typed value and then call the constructor with that value. If the value passed to a constructor is not in the lexical space of the datatype to be constructed, and cannot be converted to a value in the value space of the datatype under the rules in this specification, then an dynamic error is raised [err:FORG0001]. The semantics of the constructor function let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'627 are identical to the semantics of let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'628 cast as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'629 . See 19 Casting. If the argument to a constructor function is a literal, the result of the function may be evaluated statically; if an error is found during such evaluation, it may be reported as a static error. Special rules apply to constructor functions for let $para :=36 and types derived from let $para :=36 and 1º 2º 3º 4º ...021. See 18.2 Constructor functions for xs:QName and xs:NOTATION. The following constructor functions for the built-in atomic types are supported:
18.2 Constructor functions for xs:QName and xs:NOTATIONSpecial rules apply to constructor functions for the types let $para :=36 and 1º 2º 3º 4º ...021, for two reasons:
These constraints result in the following rules:
When a constructor function for a namespace-sensitive type is used as a literal function item or in a partial function application (for example, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'910 or let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'911) the namespace bindings that are relevant are those from the static context of the literal function item or partial function application. When a constructor function for a namespace-sensitive type is obtained by means of the let $para :=77 function, the relevant namespace bindings are those from the static context of the call on let $para :=77. Note: When the supplied argument to the let $para :=36 constructor function is a node, the node is atomized in the usual way, and if the result is let $para :=00 it is then converted as if a string had been supplied. The effect might not be what is desired. For example, given the attribute let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'916, the expression let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'917 might fail on the grounds that the prefix let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'918 is undeclared. This is because the namespace bindings are taken from the static context (that is, from the query or stylesheet), and not from the source document containing the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'919 attribute. The solution to this problem is to use the function call let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'920 instead. 18.3 Constructor functions for XML Schema built-in list typesEach of the three built-in list types defined in [XML Schema Part 2: Datatypes Second Edition], namely let $para :=42, let $para :=43, and let $para :=41, has an associated constructor function. The function signatures are as follows:
The semantics are equivalent to casting to the corresponding types from let $para :=10. All three of these types have the facet let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'943 meaning that there must always be at least one item in the list. The return type, however, allows for the fact that when the argument to the function is an empty sequence, the result is an empty sequence. Note: In the case of atomic types, it is possible to use an expression such as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'944 to convert an attribute value to an instance of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, knowing that this will work both in the case where the attribute is already annotated as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, and also in the case where it is let $para :=00. This approach does not work with list types, because it is not permitted to use a value of type let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'929 as input to the constructor function let $para :=42. Instead, it is necessary to use conditional logic that performs the conversion only in the case where the input is untyped: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'950 18.4 Constructor functions for XML Schema built-in union typesThere is a constructor function for the union type let $para :=72 defined in [XQuery and XPath Data Model (XDM) 3.1]. The function signature is:
The semantics are determined by the rules in 19.3.5 Casting to union types. These rules have the effect that:
In the case of an implementation that supports XSD 1.1, there is a constructor function associated with the built-in union type let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'978. The function signature is as follows:
The semantics are equivalent to casting to the corresponding union type (see 19.3.5 Casting to union types). Note: Because let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'978 has no member types, and therefore has an empty value space, casting will always fail with a dynamic error except in the case where the supplied argument is an empty sequence, in which case the result is also an empty sequence. 18.5 Constructor functions for user-defined typesFor every user-defined simple type in the static context (See Section 2.1.1 Static Context XP31), there is a constructor function whose name is the same as the name of the type and whose effect is to create a value of that type from the supplied argument. The rules for constructing user-defined types are defined in the same way as the rules for constructing built-in derived types defined in 18.1 Constructor functions for XML Schema built-in atomic types. Special rules apply to constructor functions for namespace-sensitive types, that is, atomic types derived from let $para :=36 and 1º 2º 3º 4º ...021, list types that have a namespace-sensitive item type, and union types that have a namespace-sensitive member type. See 18.2 Constructor functions for xs:QName and xs:NOTATION. Consider a situation where the static context contains an atomic type called let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'988 defined in a schema whose target namespace is bound to the prefix fn:abs($N * $arg2) le fn:abs($arg1) and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).782. In such a case the following constructor function is available to users: let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'990( let $para :=25 let $para :=71 let $para :=196) let $para :=71 let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'995 In the case of an atomic type A, the return type of the function is let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'996, reflecting the fact that the result will be an empty sequence if the input is an empty sequence. For a union or list type, the return type of the function is specified only as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)12. Implementations performing static type checking will often be able to compute a more specific result type. For example, if the target type is a list type whose item type is the atomic type A, the result will always be an instance of A*; if the target type is a pure union type U then the result will always be an instance of U?. In general, however, applications needing interoperable behavior on implementations that do strict static type checking will need to use a let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'998 expression to assert the specific type of the result. To construct an instance of a user-defined type that is not in a namespace, it is possible to use an let $para :=0001) or (if the host language allows it) to undeclare the default function namespace. 19 CastingConstructor functions and cast expressions accept an expression and return a value of a given type. They both convert a source value, SV, of a source type, ST, to a target value, TV, of the given target type, TT, with identical semantics and different syntax. The name of the constructor function is the same as the name of the built-in [XML Schema Part 2: Datatypes Second Edition] datatype or the datatype defined in Section 2.7 Schema Information DM31 of [XQuery and XPath Data Model (XDM) 3.1] (see 18.1 Constructor functions for XML Schema built-in atomic types) or the user-derived datatype (see 18.5 Constructor functions for user-defined types) that is the target for the conversion, and the semantics are exactly the same as for a cast expression; for example, let $para :=0002 means exactly the same as let $para :=0003 cast as op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)033. The cast expression takes a type name to indicate the target type of the conversion. See Section 3.14.2 Cast XP31. If the type name allows the empty sequence and the expression to be cast is the empty sequence, the empty sequence is returned. If the type name does not allow the empty sequence and the expression to be cast is the empty sequence, a type error is raised [err:XPTY0004]XP31. Where the argument to a cast is a literal, the result of the function may be evaluated statically; if an error is encountered during such evaluation, it may be reported as a static error. The general rules for casting from primitive types to primitive types are defined in 19.1 Casting from primitive types to primitive types, and subsections describe the rules for specific target types. The general rules for casting from let $para :=10 (and let $para :=00) follow in 19.2 Casting from xs:string and xs:untypedAtomic. Casting to non-primitive types, including atomic types derived by resctriction, union types, and list types, is described in 19.3 Casting involving non-primitive types. Casting from derived types is defined in 19.3.2 Casting from derived types to parent types, 19.3.3 Casting within a branch of the type hierarchy and 19.3.4 Casting across the type hierarchy. [Definition] Throughout this section (19 Casting), the term primitive type means either one of the 19 primitive types defined in [XML Schema Part 2: Datatypes Second Edition], or one of the types When casting from let $para :=10 or let $para :=00 the semantics in 19.2 Casting from xs:string and xs:untypedAtomic apply, regardless of target type. 19.1 Casting from primitive types to primitive typesThis section defines casting between ·primitive types· (specifically, the 19 primitive types defined in [XML Schema Part 2: Datatypes Second Edition] as well as let $para :=00, let $para :=85 and the two derived types of op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489: let $para :=24 and let $para :=25 which are treated as primitive types in this section. The type conversions that are supported between primitive atomic types are indicated in the table below; casts between other (non-primitive) types are defined in terms of these primitives. In this table, there is a row for each ·primitive type· acting as the source of the conversion and there is a column for each ·primitive type· acting as the target of the conversion. The intersections of rows and columns contain one of three characters: let $para :=0018 indicates that a conversion from values of the type to which the row applies to the type to which the column applies is supported; let $para :=911 indicates that there are no supported conversions from values of the type to which the row applies to the type to which the column applies; and let $para :=0020 indicates that a conversion from values of the type to which the row applies to the type to which the column applies may succeed for some values in the value space and fail for others. [XML Schema Part 2: Datatypes Second Edition] defines 1º 2º 3º 4º ...021 as an abstract type. Thus, casting to 1º 2º 3º 4º ...021 from any other type including 1º 2º 3º 4º ...021 is not permitted and raises a static error [err:XPST0080]XP31. However, casting from one subtype of 1º 2º 3º 4º ...021 to another subtype of 1º 2º 3º 4º ...021 is permitted. Casting is not supported to or from let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'595. Thus, there is no row or column for this type in the table below. For any node that has not been validated or has been validated as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'595, the typed value of the node is an atomic value of type let $para :=00. There are no atomic values with the type annotation let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'595 at runtime. Casting to let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'595 is not permitted and raises a static error: [err:XPST0080]XP31. Similarly, casting is not supported to or from let $para :=34 and will raise a static error: [err:XPST0080]XP31. There are no atomic values with the type annotation let $para :=34 at runtime, although this can be a statically inferred type. If casting is attempted from an ST to a TT for which casting is not supported, as defined in the table below, a type error is raised [err:XPTY0004]XP31. In the following table, the columns and rows are identified by short codes that identify simple types as follows:
In the following table, the notation "S\T" indicates that the source ("S") of the conversion is indicated in the column below the notation and that the target ("T") is indicated in the row to the right of the notation. S\TuAstrfltdbldecintduryMDdTDdTtimdatgYMgYrgMDgDaygMonboolb64hxBaURIQNNOTuAYYMMMMMMMMMMMMMMMMMMMMMstrYYMMMMMMMMMMMMMMMMMMMMMfltYYYYMMNNNNNNNNNNNYNNNNNdblYYYYMMNNNNNNNNNNNYNNNNNdecYYYYYYNNNNNNNNNNNYNNNNNintYYYYYYNNNNNNNNNNNYNNNNNdurYYNNNNYYYNNNNNNNNNNNNNNyMDYYNNNNYYYNNNNNNNNNNNNNNdTDYYNNNNYYYNNNNNNNNNNNNNNdTYYNNNNNNNYYYYYYYYNNNNNNtimYYNNNNNNNNYNNNNNNNNNNNNdatYYNNNNNNNYNYYYYYYNNNNNNgYMYYNNNNNNNNNNYNNNNNNNNNNgYrYYNNNNNNNNNNNYNNNNNNNNNgMDYYNNNNNNNNNNNNYNNNNNNNNgDayYYNNNNNNNNNNNNNYNNNNNNNgMonYYNNNNNNNNNNNNNNYNNNNNNboolYYYYYYNNNNNNNNNNNYNNNNNb64YYNNNNNNNNNNNNNNNNYYNNNhxBYYNNNNNNNNNNNNNNNNYYNNNaURIYYNNNNNNNNNNNNNNNNNNYNNQNYYNNNNNNNNNNNNNNNNNNNYMNOTYYNNNNNNNNNNNNNNNNNNNYM19.1.1 Casting to xs:string and xs:untypedAtomicCasting is permitted from any ·primitive type· to the ·primitive types· let $para :=10 and let $para :=00. When a value of any simple type is cast as let $para :=10, the derivation of the let $para :=10 value TV depends on the ST and on the SV, as follows.
To cast as let $para :=00 the value is cast as let $para :=10, as described above, and the type annotation changed to let $para :=00. Note: The string representations of numeric values are backwards compatible with XPath 1.0 except for the special values positive and negative infinity, negative zero and values outside the range let $para :=0105 to let $para :=0106. 19.1.2 Casting to numeric types19.1.2.1 Casting to xs:floatWhen a value of any simple type is cast as let $para :=83, the let $para :=83 TV is derived from the ST and the SV as follows:
Note: Implementations should return negative zero for let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'657. But because [XML Schema Part 2: Datatypes Second Edition] does not distinguish between the values positive zero and negative zero. Implementations may return positive zero in this case. 19.1.2.2 Casting to xs:doubleWhen a value of any simple type is cast as let $para :=26, the let $para :=26 value TV is derived from the ST and the SV as follows:
Note: Implementations should return negative zero for let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'664. But because [XML Schema Part 2: Datatypes Second Edition] does not distinguish between the values positive zero and negative zero. Implementations may return positive zero in this case. 19.1.2.3 Casting to xs:decimalWhen a value of any simple type is cast as let $para :=82, the let $para :=82 value TV is derived from ST and SV as follows:
19.1.2.4 Casting to xs:integerWhen a value of any simple type is cast as let $para :=85, the let $para :=85 value TV is derived from ST and SV as follows:
19.1.3 Casting to duration typesWhen a value of type let $para :=00, let $para :=10, a type derived from let $para :=10, let $para :=24 or let $para :=25 is cast as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489, let $para :=24 or let $para :=25, TV is derived from ST and SV as follows:
Note that casting from op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 to let $para :=24 or let $para :=25 loses information. To avoid this, users can cast the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)489 value to both an let $para :=24 and an let $para :=25 and work with both values. 19.1.4 Casting to date and time typesIn several situations, casting to date and time types requires the extraction of a component from SV or from the result of let $para :=69 and converting it to an let $para :=10. These conversions must follow certain rules. For example, converting an let $para :=85 year value requires converting to an let $para :=10 with four or more characters, preceded by a minus sign if the value is negative. This document defines four functions to perform these conversions. These functions are for illustrative purposes only and make no recommendations as to style or efficiency. References to these functions from the following text are not normative. The arguments to these functions come from functions defined in this document. Thus, the functions below assume that they are correct and do no range checking on them. let $para :=19 let $para :=20 let $para :=21 let $para :=22 Conversion from ·primitive types· to date and time types follows the rules below.
19.1.5 Casting to xs:booleanWhen a value of any ·primitive type· is cast as op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32, the op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 value TV is derived from ST and SV as follows:
19.1.6 Casting to xs:base64Binary and xs:hexBinaryValues of type let $para :=196 can be cast as let $para :=219 and vice versa, since the two types have the same value space. Casting to let $para :=196 and let $para :=219 is also supported from the same type and from let $para :=00, let $para :=10 and subtypes of let $para :=10 using [XML Schema Part 2: Datatypes Second Edition] semantics. 19.1.7 Casting to xs:anyURICasting to let $para :=30 is supported only from the same type, let $para :=00 or let $para :=10. When a value of any ·primitive type· is cast as let $para :=30, the let $para :=30 value TV is derived from the ST and SV as follows:
19.1.8 Casting to xs:QName and xs:NOTATIONCasting from let $para :=10 or let $para :=00 to let $para :=36 or 1º 2º 3º 4º ...021 is described in 19.2 Casting from xs:string and xs:untypedAtomic. It is also possible to cast from 1º 2º 3º 4º ...021 to let $para :=36, or from let $para :=36 to any type derived by restriction from 1º 2º 3º 4º ...021. (Casting to 1º 2º 3º 4º ...021 itself is not allowed, because 1º 2º 3º 4º ...021 is an abstract type.) The resulting let $para :=36 or 1º 2º 3º 4º ...021 has the same prefix, local name, and namespace URI parts as the supplied value. Note: See 18.2 Constructor functions for xs:QName and xs:NOTATION for a discussion of how the combination of atomization and casting might not produce the desired effect. 19.1.9 Casting to xs:ENTITY[XML Schema Part 2: Datatypes Second Edition] says that "The value space of ENTITY is the set of all strings that match the NCName production ... and have been declared as an unparsed entity in a document type definition." However, [XSL Transformations (XSLT) Version 3.0] and [XQuery 3.1: An XML Query Language] do not check that constructed values of type let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'791 match declared unparsed entities. Thus, this rule is relaxed in this specification and, in casting to let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'791 and types derived from it, no check is made that the values correspond to declared unparsed entities. 19.2 Casting from xs:string and xs:untypedAtomicThis section applies when the supplied value SV is an instance of let $para :=10 or let $para :=00, including types derived from these by restriction. If the value is let $para :=00, it is treated in exactly the same way as a string containing the same sequence of characters. The supplied string is mapped to a typed value of the target type as defined in [XML Schema Part 2: Datatypes Second Edition]. Whitespace normalization is applied as indicated by the let $para :=0495 facet for the datatype. The resulting whitespace-normalized string must be a valid lexical form for the datatype. The semantics of casting follow the rules of XML Schema validation. For example, let $para :=0496 returns the let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615 typed value let $para :=0498. This could also be written let $para :=0499. The target type can be any simple type other than an abstract type. Specifically, it can be a type whose variety is atomic, union, or list. In each case the effect of casting to the target type is the same as constructing an element with the supplied value as its content, validating the element using the target type as the governing type, and atomizing the element to obtain its typed value. When the target type is a derived type that is restricted by a pattern facet, the lexical form is first checked against the pattern before further casting is attempted (See 19.3.1 Casting to derived types). If the lexical form does not conform to the pattern, a dynamic error [err:FORG0001] is raised. For example, consider a user-defined type let $para :=0500 which is derived by restriction from op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)32 and specifies the pattern facet let $para :=0502. The expression let $para :=0503 would fail with a dynamic error [err:FORG0001]. Facets other than let $para :=0504 are checked after the conversion. For example if there is a user-defined datatype called let $para :=0505 defined as a restriction of let $para :=85 with the facet let $para :=0507, then the expression let $para :=0508 would fail with a dynamic error [err:FORG0001]. Casting to the types 1º 2º 3º 4º ...021, let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'595, or let $para :=34 is not permitted because these types are abstract (they have no immediate instances). Special rules apply when casting to namespace-sensitive types. The types let $para :=36 and 1º 2º 3º 4º ...021 are namespace-sensitive. Any type derived by restriction from a namespace-sensitive type is itself namespace-sensitive, as is any union type having a namespace-sensitive type among its members, and any list type having a namespace-sensitive type as its item type. For details, see 18.2 Constructor functions for xs:QName and xs:NOTATION. Note: This version of the specification allows casting between let $para :=36 and 1º 2º 3º 4º ...021 in either direction; this was not permitted in the previous Recommendation. This version also removes the rule that only a string literal (rather than a dynamic string) may be cast to an let $para :=36 When casting to a numeric type:
In casting to let $para :=82 or to a type derived from let $para :=82, if the value is not too large or too small but nevertheless cannot be represented accurately with the number of decimal digits available to the implementation, the implementation may round to the nearest representable value or may raise a dynamic error [err:FOCA0006]. The choice of rounding algorithm and the choice between rounding and error behavior and is ·implementation-defined·. In casting to op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964, let $para :=29, op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)967, or op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)966 (or types derived from these), if the value is too large or too small to be represented by the implementation, a dynamic error [err:FODT0001] is raised. In casting to a duration value, if the value is too large or too small to be represented by the implementation, a dynamic error [err:FODT0002] is raised. For let $para :=30, the extent to which an implementation validates the lexical form of let $para :=30 is ·implementation-dependent·. If the cast fails for any other reason, a dynamic error [err:FORG0001] is raised. 19.3 Casting involving non-primitive typesCasting from let $para :=10 and let $para :=00 to any other type (primitive or non-primitive) has been described in 19.2 Casting from xs:string and xs:untypedAtomic. This section defines how other casts to non-primitive types operate, including casting to types derived by restriction, to union types, and to list types. Note: A non-primitive type here means any type that is not a ·primitive type· according to the extended definition used in 19 Casting. 19.3.1 Casting to derived typesCasting a value to a derived type can be separated into four cases. In these rules:
The rules are then:
19.3.2 Casting from derived types to parent typesIt is always possible to cast an atomic value A to a type T if the relation let $para :=0538 is true, provided that T is not an abstract type. For example, it is possible to cast an let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'858 to an let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'615, to an let $para :=85, to an let $para :=82, or to a union type whose member types are let $para :=85 and let $para :=26. Since the value space of the original type is a subset of the value space of the target type, such a cast is always successful. For the expression let $para :=0538 to be true, T must be either an atomic type, or a union type that has no constraining facets. It cannot be a list type, nor a union type derived by restriction from another union type, nor a union type that has a list type among its member types. The result will have the same value as the original, but will have a new type annotation:
19.3.3 Casting within a branch of the type hierarchyIt is possible to cast an SV to a TT if the type of the SV and the TT type are both derived by restriction (directly or indirectly) from the same ·primitive type·, provided that the supplied value conforms to the constraints implied by the facets of the target type. This includes the case where the target type is derived from the type of the supplied value, as well as the case where the type of the supplied value is derived from the target type. For example, an instance of let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'834 can be cast as let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'858, provided the value is not negative. If the value does not conform to the facets defined for the target type, then a dynamic error is raised [err:FORG0001]. See [XML Schema Part 2: Datatypes Second Edition]. In the case of the pattern facet (which applies to the lexical space rather than the value space), the pattern is tested against the canonical lexical representation of the value, as defined for the source type (or the result of casting the value to an let $para :=10, in the case of types that have no canonical lexical representation defined for them). Note that this will cause casts to fail if the pattern excludes the canonical lexical representation of the source type. For example, if the type let $para :=0554 is defined as a restriction of let $para :=82 with a pattern that requires two digits after the decimal point, casting of an let $para :=85 to let $para :=0554 will always fail, because the canonical representation of an let $para :=85 does not conform to this pattern. In some cases, casting from a parent type to a derived type requires special rules. See 19.1.3 Casting to duration types for rules regarding casting to let $para :=24 and let $para :=25. See 19.1.9 Casting to xs:ENTITY, below, for casting to let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'791 and types derived from it. 19.3.4 Casting across the type hierarchyWhen the ST and the TT are derived, directly or indirectly, from different ·primitive types·, this is called casting across the type hierarchy. Casting across the type hierarchy is logically equivalent to three separate steps performed in order. Errors can occur in either of the latter two steps.
19.3.5 Casting to union typesIf the target type of a cast expression (or a constructor function) is a type with variety union, the supplied value must be one of the following:
If more than one of these conditions applies, then the casting is done according to the rules for the first condition that applies. If none of these conditions applies, the cast fails with a dynamic error [err:FORG0001]. Example: consider a type U whose member types are let $para :=85 and op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)964.
Example: consider a type V whose member types are let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'828 and let $C := 'http://www.w3.org/2013/collation/UCA?strength=primary'810.
Example: consider a type W that is derived from the above type V by restriction, with a pattern facet of let $para :=0595.
19.3.6 Casting to list typesIf the target type of a cast expression (or a constructor function) is a type with variety let $para :=0601, the supplied value must be of type let $para :=10 or let $para :=00. The rules follow the general principle for all casts from let $para :=10 outlined in 19.2 Casting from xs:string and xs:untypedAtomic. The semantics of the operation are consistent with validation: that is, the effect of casting a string S to a list type L is the same as constructing an element or attribute node whose string value is S, validating it using L as the governing type, and atomizing the resulting node. The result will always be either failure, or a sequence of zero or more atomic values each of which is an instance of the item type of L (or if the item type of L is a union type, an instance of one of the atomic types in its transitive membership). If the item type of the list type is namespace-sensitive, then the namespace bindings in the static context will be used to resolve any namespace prefix, in the same way as when the target type is let $para :=36. If the list type has a let $para :=0504 facet, the pattern must match the supplied value after collapsing whitespace (an operation equivalent to the use of the let $para :=215 function). For example, the expression let $para :=0608 produces a sequence of four 1º 2º 3º 4º ...642 values, let $para :=0610. For example, given a user-defined type let $para :=0611 defined as a list of let $para :=85 with the facet let $para :=0613, the expression let $para :=0614 will return a sequence of two xs:integer values let $para :=0615, while the expression let $para :=0616 will result in a dynamic error because the length of the list does not conform to the let $para :=0617 facet. The expression let $para :=0618 will also fail because the strings Primo Secondo Terzo Quarto Quinto ...662 and let $para :=104 are not in the lexical space of let $para :=85. How many 3 digit numbers have the property that the sum of their digits is even?If you allow leading zeroes, there are 1000 three-digit numbers, if you are strict, there are 900 three-digit numbers, so the final answer is 500 or 450, depending on your definition.
How many 3 digit numbers are there in which all the digits are even?The total 3 digit numbers are 999 including preceding zeros and there are 999/2 even numbers. so total three digit even numbers are 499.
How many 3 digit numbers are there whose sum of digits is equal to product of digits?Answer: 123, 321, 213 are the three-digit numbers whose sum of the digit is equal to the product of the digit.
How many 3 digit whole numbers whose digit sum is 24 are even?The answer is 4 three-digit integers.
|