xpath2 | constructors
The functions in the "constructors" sub-library of the XPath 2.0 library construct specific data types from the input text. The following table lists the available constructor functions.
xs:ENTITY | xs:double | xs:nonPositiveInteger |
xs:ID | xs:duration | xs:normalizedString |
xs:IDREF | xs:float | xs:positiveInteger |
xs:NCName | xs:gDay | xs:short |
xs:NMTOKEN | xs:gMonth | xs:string |
xs:Name | xs:gMonthDay | xs:time |
xs:QName | xs:gYear | xs:token |
xs:anyURI | xs:gYearMonth | xs:unsignedByte |
xs:base64Binary | xs:hexBinary | xs:unsignedInt |
xs:boolean | xs:int | xs:unsignedLong |
xs:byte | xs:integer | xs:unsignedShort |
xs:date | xs:language | xs:untypedAtomic |
xs:dateTime | xs:long | xs:yearMonthDuration |
xs:dayTimeDuration | xs:negativeInteger | |
xs:decimal | xs:nonNegativeInteger |
Languages
XQuery, XSLT 2.0, XSLT 3.0.
Example
Typically, the lexical format of the input text must be the one expected of the data type to be constructed. Otherwise, the transformation will not be successful. For example, to construct an xs:dateTime value using the xs:dateTime constructor function, the input text must have the lexical format of the xs:dateTime data type, which is YYYY-MM-DDTHH:mm:ss.
In the mapping illustrated above, a string constant ("2020-04-28T00:00:00") has been used to provide the input argument of the function. The input could also have been obtained from an item in the source document. The xs:dateTime function returns the value 2020-04-28T00:00:00 of type xs:dateTime.
To view the expected data type of a mapping item (including the data type of function arguments), move the mouse cursor over the respective input or output connector.