XQuery 3.1
The XQuery 3.1 Engine of StyleVision conforms to the World Wide Web Consortium's (W3C's) XQuery 3.1 Recommendation of 21 March 2017 and includes support for XPath and XQuery Functions 3.1. The XQuery 3.1 specification is a superset of the 3.0 specification. The XQuery 3.1 engine therefore supports XQuery 3.0 features.
Namespaces
Your XQuery 3.1 document should declare the following namespaces in order for you to be able to use all the type constructors and functions available in XQuery 3.1. The prefixes given below are conventionally used; you could use alternative prefixes if you wish.
Namespace Name | Prefix | Namespace URI |
XML Schema types | xs: | http://www.w3.org/2001/XMLSchema |
XPath/XQuery 3.1 functions | fn: | http://www.w3.org/2005/xpath-functions |
Math functions | math: | http://www.w3.org/2005/xpath-functions/math |
Map functions | map: | http://www.w3.org/2005/xpath-functions/map |
Array functions | array: | http://www.w3.org/2005/xpath-functions/array |
XQuery, XSLT, and XPath Error Codes | err: | http://www.w3.org/2005/xpath-functions/xqt-errors |
Serialization functions | output | http://www.w3.org/2010/xslt-xquery-serialization |
The following points should be noted:
•The XQuery 3.1 Engine recognizes the prefixes listed above as being bound to the corresponding namespaces.
•Since the built-in functions namespace listed above (see fn:) is the default functions namespace in XQuery, the fn: prefix does not need to be used when built-in functions are invoked (for example, string("Hello") will call the fn:string function). However, the prefix fn: can be used to call a built-in function without having to declare the namespace in the query prolog (for example: fn:string("Hello")).
•You can change the default functions namespace by declaring the default function namespace expression in the query prolog.
•When using types from the XML Schema namespace, the prefix xs: may be used without having to explicitly declare the namespaces and bind these prefixes to them in the query prolog. (Example: xs:date and xs:yearMonthDuration.) If you wish to use some other prefix for the XML Schema namespace, this must be explicitly declared in the query prolog. (Example: declare namespace alt = "http://www.w3.org/2001/XMLSchema"; alt:date("2004-10-04").)
If namespaces for functions, type constructors, node tests, etc are wrongly assigned, an error is reported. Note, however, that some functions have the same name as schema datatypes, e.g. fn:string and fn:boolean. (Both xs:string and xs:boolean are defined.) The namespace prefix determines whether the function or type constructor is used.
Implementation-specific behavior
Implementation-specific characteristics are the same as for XQuery 1.0.
Additionally, the Altova-specific encoding x-base64tobinary can be used to create a binary result document, such as an image.