XQilla XQuery Extension Functions
XQilla supports a number of additional functions as well as the standard XQuery functions. Some of these functions are from the XSLT 2.0 specification, and some of them are specific to XQilla. The namespace used for all XQilla specific extension functions is "http://xqilla.sourceforge.net/Functions", and it is bound to the prefix "xqilla" in the XQilla static context.
XSLT functions available from XQuery
fn:document
fn:document($uri-sequence as item()*) as node()*
fn:document($uri-sequence as item()*, $base-node as node()) as node()*
Summary: The document function allows access to XML documents identified by a URI. The
XSLT 2.0 specification∞ fully describes the semantics of this function.
fn:unparsed-text
fn:unparsed-text($href as xs:string?) as xs:string?
fn:unparsed-text($href as xs:string?, $encoding as xs:string) as xs:string?
Summary: The unparsed-text function reads an external resource (for example, a file) and returns its contents as a string. The
XSLT 2.0 specification∞ fully describes the semantics of this function.
fn:regex-group
fn:regex-group($group-number as xs:integer) as xs:string
Summary: The regex-group function allows access to the set of current captured substrings from the most recently executed xsl:analyze-string instruction or xqilla:analyze-string() function call. The
XSLT 2.0 specification∞ fully describes the semantics of this function.
XQilla extension functions
xqilla:parse-xml
xqilla:parse-xml($xml as xs:string?) as document-node()?
Summary: Parses the string argument as an XML document and returns it. If the argument is an empty sequence, the function returns the empty sequence. If the argument is invalid XML, the function raises an error.
xqilla:parse-json
xqilla:parse-json($xml as xs:string?) as element()?
Summary: Parses the string argument as a JSON document, returning
XML representing the document∞. If the argument is an empty sequence, the function returns the empty sequence. If the argument is invalid JSON, the function raises an error.
xqilla:serialize-json
xqilla:serialize-json($json-xml as element()?) as xs:string?
Summary: Serializes the XML as a JSON document. If the argument is an empty sequence, the functions returns an empty sequence. If the argument is an invalid XML representation of JSON, the function raises an error.
xqilla:parse-html
xqilla:parse-html($html as xs:string?) as document-node()?
Summary: Parses the string argument as an HTML document using
TidyLib.
TidyLib accepts badly mangled HTML and will clean it up to be valid HTML. If the argument is an empty sequence, the function returns the empty sequence. If the argument is invalid HTML that
TidyLib cannot clean up, the function will raise an error.
xqilla:time
xqilla:time($value as item()*, $label as xs:string) as item()*
Summary: Returns the first argument, outputting the time taken to evaluate it to the trace stream using the second argument as a label. This function can be useful to measure the performance of sub-expressions of a query.
xqilla:analyze-string
xqilla:analyze-string($input as xs:string?, $pattern as xs:string, $action as function(xs:string, xs:boolean) as item()*) as item()*
xqilla:analyze-string($input as xs:string?, $pattern as xs:string, $action as function(xs:string, xs:boolean) as item()*, $flags as xs:string) as item()*
Summary: Performs an equivalent function to the XSLT 2.0 instruction
xsl:analyze-string∞, returning substrings of $input that match and do not match the regular expression $pattern to the function $action. If the substring matched the regular expression, the second argument of $action will be
true(), otherwise it will be
false(). The results returned from invoking $action are concatenated together in order and returned from
xqilla:analyze-string().
CategoryXQuery
forfait mobile∞
video drole∞
forfait sans engagement∞
There are 7 comments on this page. [Display comments]