diff --git a/Backend-libXML/Parser.py b/Backend-libXML/Parser.py index 7dcb211..687fb74 100644 --- a/Backend-libXML/Parser.py +++ b/Backend-libXML/Parser.py @@ -54,12 +54,12 @@ def xpath(source: str, xpath: str) -> str: # root.xpath can return 4 types: float, string, bool and list. # List is the only one that can't be simply converted to str if type(result) is not list: - return str(result) + return str(result), type(result).__name__ else: result_string = "" for e in result: result_string += etree.tostring(e, pretty_print=True).decode() + "\n" - return result_string + return result_string, "node" diff --git a/Backend-libXML/main.py b/Backend-libXML/main.py index c0a962b..4445cab 100644 --- a/Backend-libXML/main.py +++ b/Backend-libXML/main.py @@ -35,7 +35,7 @@ def process_xml(request: request, type: str) -> str: elif (type == "xslt"): response_json['result'] = Parser.xslt(data, process) elif (type == "xpath"): - response_json['result'] = Parser.xpath(data, process) + response_json['result'], response_json['type'] = Parser.xpath(data, process) elif (type == "prettify"): response_json['result'] = Parser.formatXML(data, True) elif (type == "minimize"): diff --git a/Backend/mocked-services/src/main/java/com/r11/tools/controller/MockController.java b/Backend/mocked-services/src/main/java/com/r11/tools/controller/MockController.java index 38d0bc3..8ec6473 100644 --- a/Backend/mocked-services/src/main/java/com/r11/tools/controller/MockController.java +++ b/Backend/mocked-services/src/main/java/com/r11/tools/controller/MockController.java @@ -194,6 +194,7 @@ public class MockController { MockedMessageDto mockedMessageDto = klausService.getMockedResponse(clientUUID, mockedResponseId); HttpHeaders httpHeaders = new HttpHeaders(); if (mockedMessageDto.getHttpHeaders() != null) mockedMessageDto.getHttpHeaders().forEach(httpHeaders::set); + httpHeaders.add("Content-Type", mockedMessageDto.getMediaType()); return new ResponseEntity<>(mockedMessageDto.getMessageBody(), httpHeaders, Objects.requireNonNull(HttpStatus.valueOf(mockedMessageDto.getHttpStatus()))); } diff --git a/Backend/mocked-services/src/main/resources/static/html/mock.html b/Backend/mocked-services/src/main/resources/static/html/mock.html index bb373c8..d3ff264 100644 --- a/Backend/mocked-services/src/main/resources/static/html/mock.html +++ b/Backend/mocked-services/src/main/resources/static/html/mock.html @@ -15,7 +15,7 @@
-

MockedServices v1.0.0

+

MockedServices

@@ -309,9 +309,11 @@
Unsaved data
-
You haven't saved your message! Any changes will be lost.
Do you want to continue?
+
You haven't saved your message!
Do you want to save it?
- + + +
diff --git a/Backend/mocked-services/src/main/resources/static/js/datatransfer.js b/Backend/mocked-services/src/main/resources/static/js/datatransfer.js index adc0cc7..ba21743 100644 --- a/Backend/mocked-services/src/main/resources/static/js/datatransfer.js +++ b/Backend/mocked-services/src/main/resources/static/js/datatransfer.js @@ -155,6 +155,7 @@ function callMethodByName(methodObject){ } } + function updateData(){ var updatedJson = generateJson(); const dataSaved = function () { diff --git a/Backend/tools-services/src/main/java/com/r11/tools/SparkApplication.java b/Backend/tools-services/src/main/java/com/r11/tools/SparkApplication.java index affcebb..cee98f2 100644 --- a/Backend/tools-services/src/main/java/com/r11/tools/SparkApplication.java +++ b/Backend/tools-services/src/main/java/com/r11/tools/SparkApplication.java @@ -32,12 +32,16 @@ public class SparkApplication { .setPrettyPrinting() .create(); + Gson jsongson = new GsonBuilder() + .disableHtmlEscaping() + .create(); + RestControllerRegistry registry = new RestControllerRegistry(); registry.registerController(new ProcessorInfoController(logger)); registry.registerController(new XsdController(gson, logger)); registry.registerController(new XPathController(gson, logger)); registry.registerController(new XsltController(gson, logger)); - registry.registerController(new JsonController()); + registry.registerController(new JsonController(gson, jsongson, logger)); registry.register(); diff --git a/Backend/tools-services/src/main/java/com/r11/tools/controller/JsonController.java b/Backend/tools-services/src/main/java/com/r11/tools/controller/JsonController.java index 1d465fd..8574c3b 100644 --- a/Backend/tools-services/src/main/java/com/r11/tools/controller/JsonController.java +++ b/Backend/tools-services/src/main/java/com/r11/tools/controller/JsonController.java @@ -1,7 +1,7 @@ package com.r11.tools.controller; import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +//import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.r11.tools.controller.internal.GlobalControllerManifest; import com.r11.tools.controller.internal.HandlerType; @@ -9,18 +9,22 @@ import com.r11.tools.controller.internal.RestController; import com.r11.tools.controller.internal.ScopedControllerManifest; import spark.Request; import spark.Response; +import org.apache.logging.log4j.Logger; @GlobalControllerManifest(path = "/json") public class JsonController implements RestController { - private final Gson prettyGson = new GsonBuilder() - .disableHtmlEscaping() - .setPrettyPrinting() - .create(); + private final Logger logger; - private final Gson gson = new GsonBuilder() - .disableHtmlEscaping() - .create(); + private final Gson prettyGson; + + private final Gson gson; + + public JsonController(Gson prettyGson, Gson jsongson,Logger logger) { + this.logger = logger; + this.prettyGson = prettyGson; + this.gson = jsongson; + } @ScopedControllerManifest(method = HandlerType.POST, path = "/formatting") public void formatting(Request request, Response response) { @@ -35,17 +39,20 @@ public class JsonController implements RestController { responseJson.addProperty("data", this.prettyGson.toJson(requestJson)); responseJson.addProperty("time", System.currentTimeMillis() - startProcess); - response.body(this.prettyGson.toJson(responseJson)); + } catch (Exception e) { + this.logger.error("Error on formatting Json " + e); Throwable cause = e.getCause(); - response.status(500); + response.status(400); responseJson.addProperty("data", cause == null ? e.getMessage() : cause.getMessage()); responseJson.addProperty("time", System.currentTimeMillis() - startProcess); + + } + this.logger.info("Json processed in " + responseJson.get("time").toString() + " ms."); response.body(this.prettyGson.toJson(responseJson)); - } } @ScopedControllerManifest(method = HandlerType.POST, path = "/minimize") @@ -63,14 +70,16 @@ public class JsonController implements RestController { response.body(this.gson.toJson(responseJson)); } catch (Exception e) { + this.logger.error("Error on minimizeing Json " + e); Throwable cause = e.getCause(); - response.status(500); + response.status(400); responseJson.addProperty("data", cause == null ? e.getMessage() : cause.getMessage()); responseJson.addProperty("time", System.currentTimeMillis() - startProcess); response.body(this.prettyGson.toJson(responseJson)); } + this.logger.info("Json processed in " + responseJson.get("time").toString() + " ms."); } } diff --git a/Backend/tools-services/src/main/java/com/r11/tools/controller/XPathController.java b/Backend/tools-services/src/main/java/com/r11/tools/controller/XPathController.java index cc68603..a3d0ca2 100644 --- a/Backend/tools-services/src/main/java/com/r11/tools/controller/XPathController.java +++ b/Backend/tools-services/src/main/java/com/r11/tools/controller/XPathController.java @@ -2,10 +2,7 @@ package com.r11.tools.controller; import com.google.gson.Gson; import com.google.gson.JsonObject; -import com.r11.tools.controller.internal.GlobalControllerManifest; -import com.r11.tools.controller.internal.HandlerType; -import com.r11.tools.controller.internal.RestController; -import com.r11.tools.controller.internal.ScopedControllerManifest; +import com.r11.tools.controller.internal.*; import com.r11.tools.xml.Saxon; import com.r11.tools.xml.Xalan; import org.apache.logging.log4j.Logger; @@ -63,7 +60,7 @@ public class XPathController implements RestController { timeStart = System.currentTimeMillis(); try { - tmp = Saxon.processXPath(data, query, version).trim(); + tmp = Saxon.processXPath(data, query, version).getData().trim(); response.status(200); @@ -92,12 +89,13 @@ public class XPathController implements RestController { timeStart = System.currentTimeMillis(); try { - tmp = Xalan.processXPath(data, query).trim(); + XPathQueryResult xPathQueryResult = Xalan.processXPath(data, query); response.status(200); - responseJson.addProperty("result", tmp); + responseJson.addProperty("result", xPathQueryResult.getData().trim()); responseJson.addProperty("status", "OK"); + responseJson.addProperty("type", xPathQueryResult.getType()); } catch (Exception ex) { this.logger.error("Error on processing XPath using Xalan. " + ex); diff --git a/Backend/tools-services/src/main/java/com/r11/tools/controller/internal/XPathQueryResult.java b/Backend/tools-services/src/main/java/com/r11/tools/controller/internal/XPathQueryResult.java new file mode 100644 index 0000000..8bb8a00 --- /dev/null +++ b/Backend/tools-services/src/main/java/com/r11/tools/controller/internal/XPathQueryResult.java @@ -0,0 +1,22 @@ +package com.r11.tools.controller.internal; + +/** + * Class used to store data received from parser and type of that data (node, string, etc.) + */ +public class XPathQueryResult { + private String data; + private String type; + + public XPathQueryResult(String data, String type) { + this.data = data; + this.type = type; + } + + public String getData() { + return data; + } + + public String getType() { + return type; + } +} diff --git a/Backend/tools-services/src/main/java/com/r11/tools/xml/Saxon.java b/Backend/tools-services/src/main/java/com/r11/tools/xml/Saxon.java index 567c889..4cb2835 100644 --- a/Backend/tools-services/src/main/java/com/r11/tools/xml/Saxon.java +++ b/Backend/tools-services/src/main/java/com/r11/tools/xml/Saxon.java @@ -1,5 +1,6 @@ package com.r11.tools.xml; +import com.r11.tools.controller.internal.XPathQueryResult; import net.sf.saxon.s9api.*; import javax.xml.transform.stream.StreamSource; @@ -41,7 +42,7 @@ public class Saxon { * @return string xml representation of the node * @throws Exception thrown on node building errors or invalid xpath */ - public static String processXPath(String data, String query, String version) throws Exception { + public static XPathQueryResult processXPath(String data, String query, String version) throws Exception { Processor p = new Processor(false); XPathCompiler compiler = p.newXPathCompiler(); DocumentBuilder builder = p.newDocumentBuilder(); @@ -61,7 +62,7 @@ public class Saxon { sb.append(xdmItem); sb.append('\n'); } - return sb.toString(); + return new XPathQueryResult(sb.toString(), "N/A"); } diff --git a/Backend/tools-services/src/main/java/com/r11/tools/xml/Xalan.java b/Backend/tools-services/src/main/java/com/r11/tools/xml/Xalan.java index 829b62b..1caad08 100644 --- a/Backend/tools-services/src/main/java/com/r11/tools/xml/Xalan.java +++ b/Backend/tools-services/src/main/java/com/r11/tools/xml/Xalan.java @@ -1,5 +1,6 @@ package com.r11.tools.xml; +import com.r11.tools.controller.internal.XPathQueryResult; import org.apache.xpath.XPathAPI; import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; @@ -64,7 +65,7 @@ public class Xalan { * @return xml processed using given xpath * @throws Exception thrown on node building errors or invalid xpath */ - public static String processXPath(String data, String transform) throws Exception { + public static XPathQueryResult processXPath(String data, String transform) throws Exception { // Set up a DOM tree to query. InputSource in = new InputSource(new StringReader(data)); @@ -81,7 +82,7 @@ public class Xalan { NodeIterator nl = XPathAPI.selectNodeIterator(doc, transform); // Serialize the found nodes to result object. - StringBuilder result = new StringBuilder(); + StringBuilder resultString = new StringBuilder(); Node n; while ((n = nl.nextNode())!= null) { StringBuilder sb; @@ -90,18 +91,19 @@ public class Xalan { // single XPath text node. Coalesce all contiguous text nodes // at this level for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) { - result.append(nn.getNodeValue()); + resultString.append(nn.getNodeValue()); } } else { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream))); - result.append(outputStream); + resultString.append(outputStream); } - result.append("\n"); + resultString.append("\n"); } - return result.toString(); + return new XPathQueryResult(resultString.toString(), "node"); } catch (TransformerException e) { - return XPathAPI.eval(doc, transform).toString(); + String returnData = XPathAPI.eval(doc, transform).toString(); + return new XPathQueryResult(data, "string"); } } diff --git a/Frontend/Dockerfile b/Frontend/Dockerfile index c776286..58fdcd5 100644 --- a/Frontend/Dockerfile +++ b/Frontend/Dockerfile @@ -4,6 +4,7 @@ COPY ./tools/ /usr/share/nginx/html/tools/ COPY ./lawful/ /usr/share/nginx/html/lawful/ COPY ./assets/ /usr/share/nginx/html/assets/ COPY ./index.html /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/conf.d/default.conf RUN mkdir -p /scripts COPY insert_version.sh /scripts/ diff --git a/Frontend/assets/css/frame.css b/Frontend/assets/css/frame.css index e0b5d5f..70d0b07 100644 --- a/Frontend/assets/css/frame.css +++ b/Frontend/assets/css/frame.css @@ -142,4 +142,9 @@ div#copyright a, a:visited, a:active { #menu a:hover { transform: scale(1.25, 1.25); transition-duration: .3s; +} + +.separator{ + width: 100%; + padding:6px; } \ No newline at end of file diff --git a/Frontend/assets/css/json.css b/Frontend/assets/css/highlight.css similarity index 100% rename from Frontend/assets/css/json.css rename to Frontend/assets/css/highlight.css diff --git a/Frontend/assets/css/tools/r11form.css b/Frontend/assets/css/tools/r11form.css index 2c70e8c..d73a294 100644 --- a/Frontend/assets/css/tools/r11form.css +++ b/Frontend/assets/css/tools/r11form.css @@ -440,12 +440,11 @@ body { .content { padding: 0px 15px 0px 15px ; - text-align: justify; + text-align: left; overflow: hidden; transition: max-height .2s ease-out; max-height: 0px; border-left: #c0c2c3 2px solid; - } .collapsibleMini::before{ @@ -506,6 +505,10 @@ h2 { font-weight: 300; } +pre { + margin: 0px; +} + @media only screen and (max-width: 1024px) { .rwd-hideable { display: none; diff --git a/Frontend/assets/samples/XSLTTemplate.xslt b/Frontend/assets/samples/XSLTTemplate.xslt new file mode 100644 index 0000000..3ce05e2 --- /dev/null +++ b/Frontend/assets/samples/XSLTTemplate.xslt @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Frontend/assets/samples/sampleXMLForXSD.xml b/Frontend/assets/samples/sampleXMLForXSD.xml new file mode 100644 index 0000000..2ba2458 --- /dev/null +++ b/Frontend/assets/samples/sampleXMLForXSD.xml @@ -0,0 +1,33 @@ + + + City library + 345123 + + + 7321 + Adam + Choke + + + 5123 + Lauren + Wong + + + + + 6422 + Harry Potter + 7542 + + + 1234 + Macbeth + 5123 + + + 9556 + Romeo and Juliet + + + \ No newline at end of file diff --git a/Frontend/assets/samples/sampleXSD.xsd b/Frontend/assets/samples/sampleXSD.xsd new file mode 100644 index 0000000..6993ce3 --- /dev/null +++ b/Frontend/assets/samples/sampleXSD.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Frontend/assets/scripts/common/hljs.min.js b/Frontend/assets/scripts/common/hljs.min.js new file mode 100644 index 0000000..4cbf349 --- /dev/null +++ b/Frontend/assets/scripts/common/hljs.min.js @@ -0,0 +1,1202 @@ +/*! + Highlight.js v11.7.0 (git: 82688fad18) + (c) 2006-2022 undefined and other contributors + License: BSD-3-Clause + */ +var hljs=function(){"use strict";var e={exports:{}};function n(e){ +return e instanceof Map?e.clear=e.delete=e.set=()=>{ +throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{ +throw Error("set is read-only") +}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((t=>{var a=e[t] +;"object"!=typeof a||Object.isFrozen(a)||n(a)})),e} +e.exports=n,e.exports.default=n;class t{constructor(e){ +void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} +ignoreMatch(){this.isMatchIgnored=!0}}function a(e){ +return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") +}function i(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n] +;return n.forEach((e=>{for(const n in e)t[n]=e[n]})),t} +const r=e=>!!e.scope||e.sublanguage&&e.language;class s{constructor(e,n){ +this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){ +this.buffer+=a(e)}openNode(e){if(!r(e))return;let n="" +;n=e.sublanguage?"language-"+e.language:((e,{prefix:n})=>{if(e.includes(".")){ +const t=e.split(".") +;return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ") +}return`${n}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(n)} +closeNode(e){r(e)&&(this.buffer+="")}value(){return this.buffer}span(e){ +this.buffer+=``}}const o=(e={})=>{const n={children:[]} +;return Object.assign(n,e),n};class l{constructor(){ +this.rootNode=o(),this.stack=[this.rootNode]}get top(){ +return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ +this.top.children.push(e)}openNode(e){const n=o({scope:e}) +;this.add(n),this.stack.push(n)}closeNode(){ +if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ +for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} +walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){ +return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n), +n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){ +"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ +l._collapse(e)})))}}class c extends l{constructor(e){super(),this.options=e} +addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())} +addText(e){""!==e&&this.add(e)}addSublanguage(e,n){const t=e.root +;t.sublanguage=!0,t.language=n,this.add(t)}toHTML(){ +return new s(this,this.options).value()}finalize(){return!0}}function d(e){ +return e?"string"==typeof e?e:e.source:null}function g(e){return m("(?=",e,")")} +function u(e){return m("(?:",e,")*")}function b(e){return m("(?:",e,")?")} +function m(...e){return e.map((e=>d(e))).join("")}function p(...e){const n=(e=>{ +const n=e[e.length-1] +;return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{} +})(e);return"("+(n.capture?"":"?:")+e.map((e=>d(e))).join("|")+")"} +function _(e){return RegExp(e.toString()+"|").exec("").length-1} +const h=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ +;function f(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t +;let a=d(e),i="";for(;a.length>0;){const e=h.exec(a);if(!e){i+=a;break} +i+=a.substring(0,e.index), +a=a.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+(Number(e[1])+n):(i+=e[0], +"("===e[0]&&t++)}return i})).map((e=>`(${e})`)).join(n)} +const E="[a-zA-Z]\\w*",y="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",v="\\b(0b[01]+)",O={ +begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'", +illegal:"\\n",contains:[O]},x={scope:"string",begin:'"',end:'"',illegal:"\\n", +contains:[O]},M=(e,n,t={})=>{const a=i({scope:"comment",begin:e,end:n, +contains:[]},t);a.contains.push({scope:"doctag", +begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", +end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) +;const r=p("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) +;return a.contains.push({begin:m(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a +},S=M("//","$"),A=M("/\\*","\\*/"),C=M("#","$");var T=Object.freeze({ +__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:E,UNDERSCORE_IDENT_RE:y, +NUMBER_RE:w,C_NUMBER_RE:N,BINARY_NUMBER_RE:v, +RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", +SHEBANG:(e={})=>{const n=/^#![ ]*\// +;return e.binary&&(e.begin=m(n,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:n, +end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)}, +BACKSLASH_ESCAPE:O,APOS_STRING_MODE:k,QUOTE_STRING_MODE:x,PHRASAL_WORDS_MODE:{ +begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ +},COMMENT:M,C_LINE_COMMENT_MODE:S,C_BLOCK_COMMENT_MODE:A,HASH_COMMENT_MODE:C, +NUMBER_MODE:{scope:"number",begin:w,relevance:0},C_NUMBER_MODE:{scope:"number", +begin:N,relevance:0},BINARY_NUMBER_MODE:{scope:"number",begin:v,relevance:0}, +REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//, +end:/\/[gimuy]*/,illegal:/\n/,contains:[O,{begin:/\[/,end:/\]/,relevance:0, +contains:[O]}]}]},TITLE_MODE:{scope:"title",begin:E,relevance:0}, +UNDERSCORE_TITLE_MODE:{scope:"title",begin:y,relevance:0},METHOD_GUARD:{ +begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{ +"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{ +n.data._beginMatch!==e[1]&&n.ignoreMatch()}})});function R(e,n){ +"."===e.input[e.index-1]&&n.ignoreMatch()}function D(e,n){ +void 0!==e.className&&(e.scope=e.className,delete e.className)}function I(e,n){ +n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", +e.__beforeBegin=R,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, +void 0===e.relevance&&(e.relevance=0))}function L(e,n){ +Array.isArray(e.illegal)&&(e.illegal=p(...e.illegal))}function B(e,n){ +if(e.match){ +if(e.begin||e.end)throw Error("begin & end are not supported with match") +;e.begin=e.match,delete e.match}}function $(e,n){ +void 0===e.relevance&&(e.relevance=1)}const z=(e,n)=>{if(!e.beforeMatch)return +;if(e.starts)throw Error("beforeMatch cannot be used with starts") +;const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n] +})),e.keywords=t.keywords,e.begin=m(t.beforeMatch,g(t.begin)),e.starts={ +relevance:0,contains:[Object.assign(t,{endsParent:!0})] +},e.relevance=0,delete t.beforeMatch +},F=["of","and","for","in","not","or","if","then","parent","list","value"] +;function U(e,n,t="keyword"){const a=Object.create(null) +;return"string"==typeof e?i(t,e.split(" ")):Array.isArray(e)?i(t,e):Object.keys(e).forEach((t=>{ +Object.assign(a,U(e[t],n,t))})),a;function i(e,t){ +n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((n=>{const t=n.split("|") +;a[t[0]]=[e,j(t[0],t[1])]}))}}function j(e,n){ +return n?Number(n):(e=>F.includes(e.toLowerCase()))(e)?0:1}const P={},K=e=>{ +console.error(e)},H=(e,...n)=>{console.log("WARN: "+e,...n)},q=(e,n)=>{ +P[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),P[`${e}/${n}`]=!0) +},Z=Error();function G(e,n,{key:t}){let a=0;const i=e[t],r={},s={} +;for(let e=1;e<=n.length;e++)s[e+a]=i[e],r[e+a]=!0,a+=_(n[e-1]) +;e[t]=s,e[t]._emit=r,e[t]._multi=!0}function W(e){(e=>{ +e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, +delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ +_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope +}),(e=>{if(Array.isArray(e.begin)){ +if(e.skip||e.excludeBegin||e.returnBegin)throw K("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), +Z +;if("object"!=typeof e.beginScope||null===e.beginScope)throw K("beginScope must be object"), +Z;G(e,e.begin,{key:"beginScope"}),e.begin=f(e.begin,{joinWith:""})}})(e),(e=>{ +if(Array.isArray(e.end)){ +if(e.skip||e.excludeEnd||e.returnEnd)throw K("skip, excludeEnd, returnEnd not compatible with endScope: {}"), +Z +;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"), +Z;G(e,e.end,{key:"endScope"}),e.end=f(e.end,{joinWith:""})}})(e)}function Q(e){ +function n(n,t){ +return RegExp(d(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":"")) +}class t{constructor(){ +this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} +addRule(e,n){ +n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]), +this.matchAt+=_(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) +;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(f(e,{joinWith:"|" +}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex +;const n=this.matcherRe.exec(e);if(!n)return null +;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t] +;return n.splice(0,t),Object.assign(n,a)}}class a{constructor(){ +this.rules=[],this.multiRegexes=[], +this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ +if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t +;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))), +n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){ +return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){ +this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){ +const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex +;let t=n.exec(e) +;if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{ +const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)} +return t&&(this.regexIndex+=t.position+1, +this.regexIndex===this.count&&this.considerAll()),t}} +if(e.compilerExtensions||(e.compilerExtensions=[]), +e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") +;return e.classNameAliases=i(e.classNameAliases||{}),function t(r,s){const o=r +;if(r.isCompiled)return o +;[D,B,W,z].forEach((e=>e(r,s))),e.compilerExtensions.forEach((e=>e(r,s))), +r.__beforeBegin=null,[I,L,$].forEach((e=>e(r,s))),r.isCompiled=!0;let l=null +;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords), +l=r.keywords.$pattern, +delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=U(r.keywords,e.case_insensitive)), +o.keywordPatternRe=n(l,!0), +s&&(r.begin||(r.begin=/\B|\b/),o.beginRe=n(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/), +r.end&&(o.endRe=n(o.end)), +o.terminatorEnd=d(o.end)||"",r.endsWithParent&&s.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+s.terminatorEnd)), +r.illegal&&(o.illegalRe=n(r.illegal)), +r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((n=>i(e,{ +variants:null},n)))),e.cachedVariants?e.cachedVariants:X(e)?i(e,{ +starts:e.starts?i(e.starts):null +}):Object.isFrozen(e)?i(e):e))("self"===e?r:e)))),r.contains.forEach((e=>{t(e,o) +})),r.starts&&t(r.starts,s),o.matcher=(e=>{const n=new a +;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin" +}))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end" +}),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n})(o),o}(e)}function X(e){ +return!!e&&(e.endsWithParent||X(e.starts))}class V extends Error{ +constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}} +const J=a,Y=i,ee=Symbol("nomatch");var ne=(n=>{ +const a=Object.create(null),i=Object.create(null),r=[];let s=!0 +;const o="Could not find the language '{}', did you forget to load/include a language module?",l={ +disableAutodetect:!0,name:"Plain text",contains:[]};let d={ +ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, +languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", +cssSelector:"pre code",languages:null,__emitter:c};function _(e){ +return d.noHighlightRe.test(e)}function h(e,n,t){let a="",i="" +;"object"==typeof n?(a=e, +t=n.ignoreIllegals,i=n.language):(q("10.7.0","highlight(lang, code, ...args) has been deprecated."), +q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), +i=e,a=n),void 0===t&&(t=!0);const r={code:a,language:i};x("before:highlight",r) +;const s=r.result?r.result:f(r.language,r.code,t) +;return s.code=r.code,x("after:highlight",s),s}function f(e,n,i,r){ +const l=Object.create(null);function c(){if(!k.keywords)return void M.addText(S) +;let e=0;k.keywordPatternRe.lastIndex=0;let n=k.keywordPatternRe.exec(S),t="" +;for(;n;){t+=S.substring(e,n.index) +;const i=w.case_insensitive?n[0].toLowerCase():n[0],r=(a=i,k.keywords[a]);if(r){ +const[e,a]=r +;if(M.addText(t),t="",l[i]=(l[i]||0)+1,l[i]<=7&&(A+=a),e.startsWith("_"))t+=n[0];else{ +const t=w.classNameAliases[e]||e;M.addKeyword(n[0],t)}}else t+=n[0] +;e=k.keywordPatternRe.lastIndex,n=k.keywordPatternRe.exec(S)}var a +;t+=S.substring(e),M.addText(t)}function g(){null!=k.subLanguage?(()=>{ +if(""===S)return;let e=null;if("string"==typeof k.subLanguage){ +if(!a[k.subLanguage])return void M.addText(S) +;e=f(k.subLanguage,S,!0,x[k.subLanguage]),x[k.subLanguage]=e._top +}else e=E(S,k.subLanguage.length?k.subLanguage:null) +;k.relevance>0&&(A+=e.relevance),M.addSublanguage(e._emitter,e.language) +})():c(),S=""}function u(e,n){let t=1;const a=n.length-1;for(;t<=a;){ +if(!e._emit[t]){t++;continue}const a=w.classNameAliases[e[t]]||e[t],i=n[t] +;a?M.addKeyword(i,a):(S=i,c(),S=""),t++}}function b(e,n){ +return e.scope&&"string"==typeof e.scope&&M.openNode(w.classNameAliases[e.scope]||e.scope), +e.beginScope&&(e.beginScope._wrap?(M.addKeyword(S,w.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), +S=""):e.beginScope._multi&&(u(e.beginScope,n),S="")),k=Object.create(e,{parent:{ +value:k}}),k}function m(e,n,a){let i=((e,n)=>{const t=e&&e.exec(n) +;return t&&0===t.index})(e.endRe,a);if(i){if(e["on:end"]){const a=new t(e) +;e["on:end"](n,a),a.isMatchIgnored&&(i=!1)}if(i){ +for(;e.endsParent&&e.parent;)e=e.parent;return e}} +if(e.endsWithParent)return m(e.parent,n,a)}function p(e){ +return 0===k.matcher.regexIndex?(S+=e[0],1):(R=!0,0)}function _(e){ +const t=e[0],a=n.substring(e.index),i=m(k,e,a);if(!i)return ee;const r=k +;k.endScope&&k.endScope._wrap?(g(), +M.addKeyword(t,k.endScope._wrap)):k.endScope&&k.endScope._multi?(g(), +u(k.endScope,e)):r.skip?S+=t:(r.returnEnd||r.excludeEnd||(S+=t), +g(),r.excludeEnd&&(S=t));do{ +k.scope&&M.closeNode(),k.skip||k.subLanguage||(A+=k.relevance),k=k.parent +}while(k!==i.parent);return i.starts&&b(i.starts,e),r.returnEnd?0:t.length} +let h={};function y(a,r){const o=r&&r[0];if(S+=a,null==o)return g(),0 +;if("begin"===h.type&&"end"===r.type&&h.index===r.index&&""===o){ +if(S+=n.slice(r.index,r.index+1),!s){const n=Error(`0 width match regex (${e})`) +;throw n.languageName=e,n.badRule=h.rule,n}return 1} +if(h=r,"begin"===r.type)return(e=>{ +const n=e[0],a=e.rule,i=new t(a),r=[a.__beforeBegin,a["on:begin"]] +;for(const t of r)if(t&&(t(e,i),i.isMatchIgnored))return p(n) +;return a.skip?S+=n:(a.excludeBegin&&(S+=n), +g(),a.returnBegin||a.excludeBegin||(S=n)),b(a,e),a.returnBegin?0:n.length})(r) +;if("illegal"===r.type&&!i){ +const e=Error('Illegal lexeme "'+o+'" for mode "'+(k.scope||"")+'"') +;throw e.mode=k,e}if("end"===r.type){const e=_(r);if(e!==ee)return e} +if("illegal"===r.type&&""===o)return 1 +;if(T>1e5&&T>3*r.index)throw Error("potential infinite loop, way more iterations than matches") +;return S+=o,o.length}const w=v(e) +;if(!w)throw K(o.replace("{}",e)),Error('Unknown language: "'+e+'"') +;const N=Q(w);let O="",k=r||N;const x={},M=new d.__emitter(d);(()=>{const e=[] +;for(let n=k;n!==w;n=n.parent)n.scope&&e.unshift(n.scope) +;e.forEach((e=>M.openNode(e)))})();let S="",A=0,C=0,T=0,R=!1;try{ +for(k.matcher.considerAll();;){ +T++,R?R=!1:k.matcher.considerAll(),k.matcher.lastIndex=C +;const e=k.matcher.exec(n);if(!e)break;const t=y(n.substring(C,e.index),e) +;C=e.index+t} +return y(n.substring(C)),M.closeAllNodes(),M.finalize(),O=M.toHTML(),{ +language:e,value:O,relevance:A,illegal:!1,_emitter:M,_top:k}}catch(t){ +if(t.message&&t.message.includes("Illegal"))return{language:e,value:J(n), +illegal:!0,relevance:0,_illegalBy:{message:t.message,index:C, +context:n.slice(C-100,C+100),mode:t.mode,resultSoFar:O},_emitter:M};if(s)return{ +language:e,value:J(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:k} +;throw t}}function E(e,n){n=n||d.languages||Object.keys(a);const t=(e=>{ +const n={value:J(e),illegal:!1,relevance:0,_top:l,_emitter:new d.__emitter(d)} +;return n._emitter.addText(e),n})(e),i=n.filter(v).filter(k).map((n=>f(n,e,!1))) +;i.unshift(t);const r=i.sort(((e,n)=>{ +if(e.relevance!==n.relevance)return n.relevance-e.relevance +;if(e.language&&n.language){if(v(e.language).supersetOf===n.language)return 1 +;if(v(n.language).supersetOf===e.language)return-1}return 0})),[s,o]=r,c=s +;return c.secondBest=o,c}function y(e){let n=null;const t=(e=>{ +let n=e.className+" ";n+=e.parentNode?e.parentNode.className:"" +;const t=d.languageDetectRe.exec(n);if(t){const n=v(t[1]) +;return n||(H(o.replace("{}",t[1])), +H("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"} +return n.split(/\s+/).find((e=>_(e)||v(e)))})(e);if(_(t))return +;if(x("before:highlightElement",{el:e,language:t +}),e.children.length>0&&(d.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), +console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), +console.warn("The element with unescaped HTML:"), +console.warn(e)),d.throwUnescapedHTML))throw new V("One of your code blocks includes unescaped HTML.",e.innerHTML) +;n=e;const a=n.textContent,r=t?h(a,{language:t,ignoreIllegals:!0}):E(a) +;e.innerHTML=r.value,((e,n,t)=>{const a=n&&i[n]||t +;e.classList.add("hljs"),e.classList.add("language-"+a) +})(e,t,r.language),e.result={language:r.language,re:r.relevance, +relevance:r.relevance},r.secondBest&&(e.secondBest={ +language:r.secondBest.language,relevance:r.secondBest.relevance +}),x("after:highlightElement",{el:e,result:r,text:a})}let w=!1;function N(){ +"loading"!==document.readyState?document.querySelectorAll(d.cssSelector).forEach(y):w=!0 +}function v(e){return e=(e||"").toLowerCase(),a[e]||a[i[e]]} +function O(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ +i[e.toLowerCase()]=n}))}function k(e){const n=v(e) +;return n&&!n.disableAutodetect}function x(e,n){const t=e;r.forEach((e=>{ +e[t]&&e[t](n)}))} +"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ +w&&N()}),!1),Object.assign(n,{highlight:h,highlightAuto:E,highlightAll:N, +highlightElement:y, +highlightBlock:e=>(q("10.7.0","highlightBlock will be removed entirely in v12.0"), +q("10.7.0","Please use highlightElement now."),y(e)),configure:e=>{d=Y(d,e)}, +initHighlighting:()=>{ +N(),q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, +initHighlightingOnLoad:()=>{ +N(),q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") +},registerLanguage:(e,t)=>{let i=null;try{i=t(n)}catch(n){ +if(K("Language definition for '{}' could not be registered.".replace("{}",e)), +!s)throw n;K(n),i=l} +i.name||(i.name=e),a[e]=i,i.rawDefinition=t.bind(null,n),i.aliases&&O(i.aliases,{ +languageName:e})},unregisterLanguage:e=>{delete a[e] +;for(const n of Object.keys(i))i[n]===e&&delete i[n]}, +listLanguages:()=>Object.keys(a),getLanguage:v,registerAliases:O, +autoDetection:k,inherit:Y,addPlugin:e=>{(e=>{ +e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{ +e["before:highlightBlock"](Object.assign({block:n.el},n)) +}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{ +e["after:highlightBlock"](Object.assign({block:n.el},n))})})(e),r.push(e)} +}),n.debugMode=()=>{s=!1},n.safeMode=()=>{s=!0 +},n.versionString="11.7.0",n.regex={concat:m,lookahead:g,either:p,optional:b, +anyNumberOfTimes:u};for(const n in T)"object"==typeof T[n]&&e.exports(T[n]) +;return Object.assign(n,T),n})({});const te=e=>({IMPORTANT:{scope:"meta", +begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{ +scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/}, +FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/}, +ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$", +contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{ +scope:"number", +begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", +relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/} +}),ae=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ie=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],re=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],se=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],oe=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),le=re.concat(se) +;var ce="\\.([0-9](_*[0-9])*)",de="[0-9a-fA-F](_*[0-9a-fA-F])*",ge={ +className:"number",variants:[{ +begin:`(\\b([0-9](_*[0-9])*)((${ce})|\\.)?|(${ce}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` +},{begin:`\\b([0-9](_*[0-9])*)((${ce})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{ +begin:`(${ce})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{ +begin:`\\b0[xX]((${de})\\.?|(${de})?\\.(${de}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` +},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${de})[lL]?\\b`},{ +begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}], +relevance:0};function ue(e,n,t){return-1===t?"":e.replace(n,(a=>ue(e,n,t-1)))} +const be="[A-Za-z$_][0-9A-Za-z$_]*",me=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],pe=["true","false","null","undefined","NaN","Infinity"],_e=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],he=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ee=["arguments","this","super","console","window","document","localStorage","module","global"],ye=[].concat(fe,_e,he) +;function we(e){const n=e.regex,t=be,a={begin:/<[A-Za-z0-9\\._:-]+/, +end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ +const t=e[0].length+e.index,a=e.input[t] +;if("<"===a||","===a)return void n.ignoreMatch();let i +;">"===a&&(((e,{after:n})=>{const t="",k={ +match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(O)], +keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]} +;return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:i,exports:{ +PARAMS_CONTAINS:p,CLASS_REFERENCE:f},illegal:/#(?![$_A-z])/, +contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ +label:"use_strict",className:"meta",relevance:10, +begin:/^\s*['"]use (strict|asm)['"]/ +},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,d,g,u,{match:/\$\d+/},o,f,{ +className:"attr",begin:t+n.lookahead(":"),relevance:0},k,{ +begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", +keywords:"return throw case",relevance:0,contains:[u,e.REGEXP_MODE,{ +className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{ +className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{ +className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0, +excludeEnd:!0,keywords:i,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/, +relevance:0},{variants:[{begin:"<>",end:""},{ +match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:a.begin, +"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{ +begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},E,{ +beginKeywords:"while if switch catch for"},{ +begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", +returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:t, +className:"title.function"})]},{match:/\.\.\./,relevance:0},N,{match:"\\$"+t, +relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, +contains:[_]},y,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, +className:"variable.constant"},h,v,{match:/\$[(.]/}]}} +const Ne=e=>m(/\b/,e,/\w$/.test(e)?/\b/:/\B/),ve=["Protocol","Type"].map(Ne),Oe=["init","self"].map(Ne),ke=["Any","Self"],xe=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","break","case","catch","class","continue","convenience","default","defer","deinit","didSet","distributed","do","dynamic","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Me=["false","nil","true"],Se=["assignment","associativity","higherThan","left","lowerThan","none","right"],Ae=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warn_unqualified_access","#warning"],Ce=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Te=p(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Re=p(Te,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),De=m(Te,Re,"*"),Ie=p(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Le=p(Ie,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Be=m(Ie,Le,"*"),$e=m(/[A-Z]/,Le,"*"),ze=["autoclosure",m(/convention\(/,p("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",m(/objc\(/,Be,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","testable","UIApplicationMain","unknown","usableFromInline"],Fe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"] +;var Ue=Object.freeze({__proto__:null,grmr_bash:e=>{const n=e.regex,t={},a={ +begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]} +;Object.assign(t,{className:"variable",variants:[{ +begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const i={ +className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r={ +begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/, +end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/, +contains:[e.BACKSLASH_ESCAPE,t,i]};i.contains.push(s);const o={begin:/\$?\(\(/, +end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t] +},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10 +}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0, +contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{ +name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/, +keyword:["if","then","else","elif","fi","for","while","in","do","done","case","esac","function"], +literal:["true","false"], +built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"] +},contains:[l,e.SHEBANG(),c,o,e.HASH_COMMENT_MODE,r,{match:/(\/[a-z._-]+)+/},s,{ +className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}}, +grmr_c:e=>{const n=e.regex,t=e.COMMENT("//","$",{contains:[{begin:/\\\n/}] +}),a="[a-zA-Z_]\\w*::",i="(decltype\\(auto\\)|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ +className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{ +match:/\batomic_[a-z]{3,6}\b/}]},s={className:"string",variants:[{ +begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ +begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", +end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ +begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ +className:"number",variants:[{begin:"\\b(0b[01']+)"},{ +begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" +},{ +begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" +}],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ +keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" +},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{ +className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={ +className:"title",begin:n.optional(a)+e.IDENT_RE,relevance:0 +},d=n.optional(a)+e.IDENT_RE+"\\s*\\(",g={ +keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"], +type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"], +literal:"true false NULL", +built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr" +},u=[l,r,t,e.C_BLOCK_COMMENT_MODE,o,s],b={variants:[{begin:/=/,end:/;/},{ +begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], +keywords:g,contains:u.concat([{begin:/\(/,end:/\)/,keywords:g, +contains:u.concat(["self"]),relevance:0}]),relevance:0},m={ +begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, +keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", +keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[e.inherit(c,{ +className:"title.function"})],relevance:0},{relevance:0,match:/,/},{ +className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0, +contains:[t,e.C_BLOCK_COMMENT_MODE,s,o,r,{begin:/\(/,end:/\)/,keywords:g, +relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,o,r]}] +},r,t,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C",aliases:["h"],keywords:g, +disableAutodetect:!0,illegal:"=]/,contains:[{ +beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:l, +strings:s,keywords:g}}},grmr_cpp:e=>{const n=e.regex,t=e.COMMENT("//","$",{ +contains:[{begin:/\\\n/}] +}),a="[a-zA-Z_]\\w*::",i="(?!struct)(decltype\\(auto\\)|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ +className:"type",begin:"\\b[a-z\\d_]*_t\\b"},s={className:"string",variants:[{ +begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ +begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", +end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ +begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ +className:"number",variants:[{begin:"\\b(0b[01']+)"},{ +begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" +},{ +begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" +}],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ +keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" +},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{ +className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={ +className:"title",begin:n.optional(a)+e.IDENT_RE,relevance:0 +},d=n.optional(a)+e.IDENT_RE+"\\s*\\(",g={ +type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"], +keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"], +literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"], +_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"] +},u={className:"function.dispatch",relevance:0,keywords:{ +_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"] +}, +begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/)) +},b=[u,l,r,t,e.C_BLOCK_COMMENT_MODE,o,s],m={variants:[{begin:/=/,end:/;/},{ +begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], +keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g, +contains:b.concat(["self"]),relevance:0}]),relevance:0},p={className:"function", +begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, +keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", +keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[c],relevance:0},{ +begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[s,o]},{ +relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g, +relevance:0,contains:[t,e.C_BLOCK_COMMENT_MODE,s,o,r,{begin:/\(/,end:/\)/, +keywords:g,relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,o,r]}] +},r,t,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C++", +aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"",keywords:g,contains:["self",r]},{begin:e.IDENT_RE+"::",keywords:g},{ +match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/], +className:{1:"keyword",3:"title.class"}}])}},grmr_csharp:e=>{const n={ +keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]), +built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"], +literal:["default","false","null","true"]},t=e.inherit(e.TITLE_MODE,{ +begin:"[a-zA-Z](\\.?\\w)*"}),a={className:"number",variants:[{ +begin:"\\b(0b[01']+)"},{ +begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{ +begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" +}],relevance:0},i={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}] +},r=e.inherit(i,{illegal:/\n/}),s={className:"subst",begin:/\{/,end:/\}/, +keywords:n},o=e.inherit(s,{illegal:/\n/}),l={className:"string",begin:/\$"/, +end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/ +},e.BACKSLASH_ESCAPE,o]},c={className:"string",begin:/\$@"/,end:'"',contains:[{ +begin:/\{\{/},{begin:/\}\}/},{begin:'""'},s]},d=e.inherit(c,{illegal:/\n/, +contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},o]}) +;s.contains=[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE], +o.contains=[d,l,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{ +illegal:/\n/})];const g={variants:[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] +},u={begin:"<",end:">",contains:[{beginKeywords:"in out"},t] +},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",m={ +begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"], +keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0, +contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{ +begin:"\x3c!--|--\x3e"},{begin:""}]}] +}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#", +end:"$",keywords:{ +keyword:"if else elif endif define undef warning error line region endregion pragma checksum" +}},g,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/, +illegal:/[^\s:,]/,contains:[{beginKeywords:"where class" +},t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace", +relevance:0,end:/[{;=]/,illegal:/[^\s:]/, +contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ +beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/, +contains:[t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta", +begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{ +className:"string",begin:/"/,end:/"/}]},{ +beginKeywords:"new return throw await else",relevance:0},{className:"function", +begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, +end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{ +beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", +relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, +contains:[e.TITLE_MODE,u],relevance:0},{match:/\(\)/},{className:"params", +begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0, +contains:[g,a,e.C_BLOCK_COMMENT_MODE] +},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},m]}},grmr_css:e=>{ +const n=e.regex,t=te(e),a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{ +name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{ +keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"}, +contains:[t.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/ +},t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0 +},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0 +},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{ +begin:":("+re.join("|")+")"},{begin:":(:)?("+se.join("|")+")"}] +},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oe.join("|")+")\\b"},{ +begin:/:/,end:/[;}{]/, +contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{ +begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri" +},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0, +excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]", +relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/ +},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{ +$pattern:/[a-z-]+/,keyword:"and or not only",attribute:ie.join(" ")},contains:[{ +begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{ +className:"selector-tag",begin:"\\b("+ae.join("|")+")\\b"}]}},grmr_diff:e=>{ +const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{ +className:"meta",relevance:10, +match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/) +},{className:"comment",variants:[{ +begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/), +end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{ +className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/, +end:/$/}]}},grmr_go:e=>{const n={ +keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"], +type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"], +literal:["true","false","iota","nil"], +built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"] +};return{name:"Go",aliases:["golang"],keywords:n,illegal:"{const n=e.regex;return{name:"GraphQL",aliases:["gql"], +case_insensitive:!0,disableAutodetect:!1,keywords:{ +keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"], +literal:["true","false","null"]}, +contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{ +scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation", +begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/, +end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{ +scope:"symbol",begin:n.concat(/[_A-Za-z][_0-9A-Za-z]*/,n.lookahead(/\s*:/)), +relevance:0}],illegal:[/[;<']/,/BEGIN/]}},grmr_ini:e=>{const n=e.regex,t={ +className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{ +begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/, +end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{ +begin:/\$\{(.*?)\}/}]},r={className:"literal", +begin:/\bon|off|true|false|yes|no\b/},s={className:"string", +contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{ +begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}] +},o={begin:/\[/,end:/\]/,contains:[a,r,i,s,t,"self"],relevance:0 +},l=n.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{ +name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/, +contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{ +begin:n.concat(l,"(\\s*\\.\\s*",l,")*",n.lookahead(/\s*=\s*[^#\s]/)), +className:"attr",starts:{end:/$/,contains:[a,o,r,i,s,t]}}]}},grmr_java:e=>{ +const n=e.regex,t="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",a=t+ue("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),i={ +keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"], +literal:["false","true","null"], +type:["char","boolean","long","float","int","byte","short","double"], +built_in:["super","this"]},r={className:"meta",begin:"@"+t,contains:[{ +begin:/\(/,end:/\)/,contains:["self"]}]},s={className:"params",begin:/\(/, +end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0} +;return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/, +contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/, +relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{ +begin:/import java\.[a-z]+\./,keywords:"import",relevance:2 +},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/, +className:"string",contains:[e.BACKSLASH_ESCAPE] +},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{ +match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{ +1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{ +begin:[n.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type", +3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword", +3:"title.class"},contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ +beginKeywords:"new throw return else",relevance:0},{ +begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{ +2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/, +end:/\)/,keywords:i,relevance:0, +contains:[r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,ge,e.C_BLOCK_COMMENT_MODE] +},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},ge,r]}},grmr_javascript:we, +grmr_json:e=>{const n=["true","false","null"],t={scope:"literal", +beginKeywords:n.join(" ")};return{name:"JSON",keywords:{literal:n},contains:[{ +className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{ +match:/[{}[\],:]/,className:"punctuation",relevance:0 +},e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE], +illegal:"\\S"}},grmr_kotlin:e=>{const n={ +keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual", +built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing", +literal:"true false null"},t={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@" +},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={ +className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string", +variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,a]},{begin:"'",end:"'", +illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/, +contains:[e.BACKSLASH_ESCAPE,i,a]}]};a.contains.push(r);const s={ +className:"meta", +begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?" +},o={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/, +end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}] +},l=ge,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={ +variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/, +contains:[]}]},g=d;return g.variants[1].contains=[d],d.variants[1].contains=[g], +{name:"Kotlin",aliases:["kt","kts"],keywords:n, +contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag", +begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,{className:"keyword", +begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol", +begin:/@\w+/}]}},t,s,o,{className:"function",beginKeywords:"fun",end:"[(]|$", +returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{ +begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0, +contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://, +keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/, +endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/, +endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,c],relevance:0 +},e.C_LINE_COMMENT_MODE,c,s,o,r,e.C_NUMBER_MODE]},c]},{ +begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{ +3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0, +illegal:"extends implements",contains:[{ +beginKeywords:"public protected internal private constructor" +},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0, +excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/, +excludeBegin:!0,returnEnd:!0},s,o]},r,{className:"meta",begin:"^#!/usr/bin/env", +end:"$",illegal:"\n"},l]}},grmr_less:e=>{ +const n=te(e),t=le,a="([\\w-]+|@\\{[\\w-]+\\})",i=[],r=[],s=e=>({ +className:"string",begin:"~?"+e+".*?"+e}),o=(e,n,t)=>({className:e,begin:n, +relevance:t}),l={$pattern:/[a-z-]+/,keyword:"and or not only", +attribute:ie.join(" ")},c={begin:"\\(",end:"\\)",contains:r,keywords:l, +relevance:0} +;r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s("'"),s('"'),n.CSS_NUMBER_MODE,{ +begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]", +excludeEnd:!0} +},n.HEXCOLOR,c,o("variable","@@?[\\w-]+",10),o("variable","@\\{[\\w-]+\\}"),o("built_in","~?`[^`]*?`"),{ +className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0 +},n.IMPORTANT,{beginKeywords:"and not"},n.FUNCTION_DISPATCH);const d=r.concat({ +begin:/\{/,end:/\}/,contains:i}),g={beginKeywords:"when",endsWithParent:!0, +contains:[{beginKeywords:"and not"}].concat(r)},u={begin:a+"\\s*:", +returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/ +},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oe.join("|")+")\\b", +end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:r}}] +},b={className:"keyword", +begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b", +starts:{end:"[;{}]",keywords:l,returnEnd:!0,contains:r,relevance:0}},m={ +className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{ +begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:d}},p={variants:[{ +begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0, +returnEnd:!0,illegal:"[<='$\"]",relevance:0, +contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,o("keyword","all\\b"),o("variable","@\\{[\\w-]+\\}"),{ +begin:"\\b("+ae.join("|")+")\\b",className:"selector-tag" +},n.CSS_NUMBER_MODE,o("selector-tag",a,0),o("selector-id","#"+a),o("selector-class","\\."+a,0),o("selector-tag","&",0),n.ATTRIBUTE_SELECTOR_MODE,{ +className:"selector-pseudo",begin:":("+re.join("|")+")"},{ +className:"selector-pseudo",begin:":(:)?("+se.join("|")+")"},{begin:/\(/, +end:/\)/,relevance:0,contains:d},{begin:"!important"},n.FUNCTION_DISPATCH]},_={ +begin:`[\\w-]+:(:)?(${t.join("|")})`,returnBegin:!0,contains:[p]} +;return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,m,_,u,p,g,n.FUNCTION_DISPATCH), +{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:i}}, +grmr_lua:e=>{const n="\\[=*\\[",t="\\]=*\\]",a={begin:n,end:t,contains:["self"] +},i=[e.COMMENT("--(?!\\[=*\\[)","$"),e.COMMENT("--\\[=*\\[",t,{contains:[a], +relevance:10})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE, +literal:"true false nil", +keyword:"and break do else elseif end for goto if in local not or repeat return then until while", +built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove" +},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)", +contains:[e.inherit(e.TITLE_MODE,{ +begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params", +begin:"\\(",endsWithParent:!0,contains:i}].concat(i) +},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string", +begin:n,end:t,contains:[a],relevance:5}])}},grmr_makefile:e=>{const n={ +className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)", +contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{ +const n=e.regex,t=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a={ +className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/, +contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}] +},r=e.inherit(i,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{ +className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={ +endsWithParent:!0,illegal:/`]+/}]}]}]};return{ +name:"HTML, XML", +aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"], +case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,o,s,r,{begin:/\[/,end:/\]/,contains:[{ +className:"meta",begin://,contains:[i,r,o,s]}]}] +},e.COMMENT(//,{relevance:10}),{begin://, +relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/, +relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag", +begin:/)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{ +end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag", +begin:/)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{ +end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{ +className:"tag",begin:/<>|<\/>/},{className:"tag", +begin:n.concat(//,/>/,/\s/)))), +end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:l}]},{ +className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(t,/>/))),contains:[{ +className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]} +},grmr_markdown:e=>{const n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml", +relevance:0},t={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{ +begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, +relevance:2},{ +begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/), +relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{ +begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/ +},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0, +returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)", +excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[", +end:"\\]",excludeBegin:!0,excludeEnd:!0}]},a={className:"strong",contains:[], +variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}] +},i={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{ +begin:/_(?![_\s])/,end:/_/,relevance:0}]},r=e.inherit(a,{contains:[] +}),s=e.inherit(i,{contains:[]});a.contains.push(s),i.contains.push(r) +;let o=[n,t];return[a,i,r,s].forEach((e=>{e.contains=e.contains.concat(o) +})),o=o.concat(a,i),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{ +className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:o},{ +begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n", +contains:o}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", +end:"\\s+",excludeEnd:!0},a,i,{className:"quote",begin:"^>\\s+",contains:o, +end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{ +begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{ +begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))", +contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ +begin:"^[-\\*]{3,}",end:"$"},t,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ +className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ +className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}},grmr_objectivec:e=>{ +const n=/[a-zA-Z@][a-zA-Z0-9_]*/,t={$pattern:n, +keyword:["@interface","@class","@protocol","@implementation"]};return{ +name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"], +keywords:{"variable.language":["this","super"],$pattern:n, +keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"], +literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"], +built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"], +type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"] +},illegal:"/,end:/$/,illegal:"\\n" +},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class", +begin:"("+t.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:t, +contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE, +relevance:0}]}},grmr_perl:e=>{const n=e.regex,t=/[dualxmsipngr]{0,12}/,a={ +$pattern:/[\w.]+/, +keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0" +},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},r={begin:/->\{/, +end:/\}/},s={variants:[{begin:/\$\d/},{ +begin:n.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])") +},{begin:/[$%@][^\s\w{]/,relevance:0}] +},o=[e.BACKSLASH_ESCAPE,i,s],l=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],c=(e,a,i="\\1")=>{ +const r="\\1"===i?i:n.concat(i,a) +;return n.concat(n.concat("(?:",e,")"),a,/(?:\\.|[^\\\/])*?/,r,/(?:\\.|[^\\\/])*?/,i,t) +},d=(e,a,i)=>n.concat(n.concat("(?:",e,")"),a,/(?:\\.|[^\\\/])*?/,i,t),g=[s,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{ +endsWithParent:!0}),r,{className:"string",contains:o,variants:[{ +begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[", +end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{ +begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">", +relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'", +contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`", +contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{ +begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number", +begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b", +relevance:0},{ +begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*", +keywords:"split return print reverse grep",relevance:0, +contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{ +begin:c("s|tr|y",n.either(...l,{capture:!0}))},{begin:c("s|tr|y","\\(","\\)")},{ +begin:c("s|tr|y","\\[","\\]")},{begin:c("s|tr|y","\\{","\\}")}],relevance:2},{ +className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{ +begin:d("(?:m|qr)?",/\//,/\//)},{begin:d("m|qr",n.either(...l,{capture:!0 +}),/\1/)},{begin:d("m|qr",/\(/,/\)/)},{begin:d("m|qr",/\[/,/\]/)},{ +begin:d("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub", +end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE]},{ +begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$", +subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}] +}];return i.contains=g,r.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:a, +contains:g}},grmr_php:e=>{ +const n=e.regex,t=/(?![A-Za-z0-9])(?![$])/,a=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),r={ +scope:"variable",match:"\\$+"+a},s={scope:"subst",variants:[{begin:/\$\w+/},{ +begin:/\{\$/,end:/\}/}]},o=e.inherit(e.APOS_STRING_MODE,{illegal:null +}),l="[ \t\n]",c={scope:"string",variants:[e.inherit(e.QUOTE_STRING_MODE,{ +illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(s) +}),o,e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*(\w+)\n/,end:/[ \t]*(\w+)\b/, +contains:e.QUOTE_STRING_MODE.contains.concat(s)})]},d={scope:"number", +variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{ +begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{ +begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{ +begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?" +}],relevance:0 +},g=["false","null","true"],u=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],b=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],m={ +keyword:u,literal:(e=>{const n=[];return e.forEach((e=>{ +n.push(e),e.toLowerCase()===e?n.push(e.toUpperCase()):n.push(e.toLowerCase()) +})),n})(g),built_in:b},p=e=>e.map((e=>e.replace(/\|\d+$/,""))),_={variants:[{ +match:[/new/,n.concat(l,"+"),n.concat("(?!",p(b).join("\\b|"),"\\b)"),i],scope:{ +1:"keyword",4:"title.class"}}]},h=n.concat(a,"\\b(?!\\()"),f={variants:[{ +match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),h],scope:{2:"variable.constant" +}},{match:[/::/,/class/],scope:{2:"variable.language"}},{ +match:[i,n.concat(/::/,n.lookahead(/(?!class\b)/)),h],scope:{1:"title.class", +3:"variable.constant"}},{match:[i,n.concat("::",n.lookahead(/(?!class\b)/))], +scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class", +3:"variable.language"}}]},E={scope:"attr", +match:n.concat(a,n.lookahead(":"),n.lookahead(/(?!::)/))},y={relevance:0, +begin:/\(/,end:/\)/,keywords:m,contains:[E,r,f,e.C_BLOCK_COMMENT_MODE,c,d,_] +},w={relevance:0, +match:[/\b/,n.concat("(?!fn\\b|function\\b|",p(u).join("\\b|"),"|",p(b).join("\\b|"),"\\b)"),a,n.concat(l,"*"),n.lookahead(/(?=\()/)], +scope:{3:"title.function.invoke"},contains:[y]};y.contains.push(w) +;const N=[E,f,e.C_BLOCK_COMMENT_MODE,c,d,_];return{case_insensitive:!1, +keywords:m,contains:[{begin:n.concat(/#\[\s*/,i),beginScope:"meta",end:/]/, +endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{ +begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]}, +contains:["self",...N]},...N,{scope:"meta",match:i}] +},e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{ +scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/, +keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE, +contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{ +begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{ +begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},r,w,f,{ +match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},_,{ +scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/, +excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use" +},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params", +begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:m, +contains:["self",r,f,e.C_BLOCK_COMMENT_MODE,c,d]}]},{scope:"class",variants:[{ +beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait", +illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{ +beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{ +beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/, +contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{ +beginKeywords:"use",relevance:0,end:";",contains:[{ +match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},c,d]} +},grmr_php_template:e=>({name:"PHP template",subLanguage:"xml",contains:[{ +begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*", +end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0 +},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null, +skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null, +contains:null,skip:!0})]}]}),grmr_plaintext:e=>({name:"Plain text", +aliases:["text","txt"],disableAutodetect:!0}),grmr_python:e=>{ +const n=e.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={ +$pattern:/[A-Za-z]\w+|__\w+__/,keyword:a, +built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"], +literal:["__debug__","Ellipsis","False","None","NotImplemented","True"], +type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"] +},r={className:"meta",begin:/^(>>>|\.\.\.) /},s={className:"subst",begin:/\{/, +end:/\}/,keywords:i,illegal:/#/},o={begin:/\{\{/,relevance:0},l={ +className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ +begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, +contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{ +begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, +contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{ +begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, +contains:[e.BACKSLASH_ESCAPE,r,o,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, +end:/"""/,contains:[e.BACKSLASH_ESCAPE,r,o,s]},{begin:/([uU]|[rR])'/,end:/'/, +relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ +begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, +end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, +contains:[e.BACKSLASH_ESCAPE,o,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, +contains:[e.BACKSLASH_ESCAPE,o,s]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] +},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,g="\\b|"+a.join("|"),u={ +className:"number",relevance:0,variants:[{ +begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${g})`},{begin:`(${d})[jJ]?`},{ +begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{ +begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})` +},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${c})[jJ](?=${g})` +}]},b={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:i, +contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={ +className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/, +end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i, +contains:["self",r,u,l,e.HASH_COMMENT_MODE]}]};return s.contains=[l,u,r],{ +name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i, +illegal:/(<\/|->|\?)|=>/,contains:[r,u,{begin:/\bself\b/},{beginKeywords:"if", +relevance:0},l,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{ +1:"keyword",3:"title.function"},contains:[m]},{variants:[{ +match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}], +scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{ +className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[u,m,l]}]}}, +grmr_python_repl:e=>({aliases:["pycon"],contains:[{className:"meta.prompt", +starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{ +begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}),grmr_r:e=>{ +const n=e.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/) +;return{name:"R",keywords:{$pattern:t, +keyword:"function if in break next repeat else for while", +literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", +built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" +},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/, +starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)), +endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{ +scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0 +}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}] +}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE], +variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"', +relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{ +1:"operator",2:"number"},match:[i,a]},{scope:{1:"operator",2:"number"}, +match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[r,a]},{scope:{ +2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"}, +match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{ +match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`", +contains:[{begin:/\\./}]}]}},grmr_ruby:e=>{ +const n=e.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=n.concat(a,/(::\w+)*/),r={ +"variable.constant":["__FILE__","__LINE__","__ENCODING__"], +"variable.language":["self","super"], +keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"], +built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"], +literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},o={ +begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[s] +}),e.COMMENT("^=begin","^=end",{contains:[s],relevance:10 +}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/, +end:/\}/,keywords:r},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c], +variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{ +begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{ +begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//, +end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{ +begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{ +begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{ +begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{ +begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{ +begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)), +contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/, +contains:[e.BACKSLASH_ESCAPE,c]})]}]},g="[0-9](_?[0-9])*",u={className:"number", +relevance:0,variants:[{ +begin:`\\b([1-9](_?[0-9])*|0)(\\.(${g}))?([eE][+-]?(${g})|r)?i?\\b`},{ +begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b" +},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{ +begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{ +begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{ +className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0, +keywords:r}]},m=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{ +match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class", +4:"title.class.inherited"},keywords:r},{match:[/(include|extend)\s+/,i],scope:{ +2:"title.class"},keywords:r},{relevance:0,match:[i,/\.new[. (]/],scope:{ +1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, +className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{ +match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[b]},{ +begin:e.IDENT_RE+"::"},{className:"symbol", +begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol", +begin:":(?!\\s)",contains:[d,{begin:t}],relevance:0},u,{className:"variable", +begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{ +className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0, +relevance:0,keywords:r},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*", +keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c], +illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{ +begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[", +end:"\\][a-z]*"}]}].concat(o,l),relevance:0}].concat(o,l) +;c.contains=m,b.contains=m;const p=[{begin:/^\s*=>/,starts:{end:"$",contains:m} +},{className:"meta.prompt", +begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])", +starts:{end:"$",keywords:r,contains:m}}];return l.unshift(o),{name:"Ruby", +aliases:["rb","gemspec","podspec","thor","irb"],keywords:r,illegal:/\/\*/, +contains:[e.SHEBANG({binary:"ruby"})].concat(p).concat(l).concat(m)}}, +grmr_rust:e=>{const n=e.regex,t={className:"title.function.invoke",relevance:0, +begin:n.concat(/\b/,/(?!let\b)/,e.IDENT_RE,n.lookahead(/\s*\(/)) +},a="([ui](8|16|32|64|128|size)|f(32|64))?",i=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],r=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"] +;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:r, +keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"], +literal:["true","false","Some","None","Ok","Err"],built_in:i},illegal:""},t]}}, +grmr_scss:e=>{const n=te(e),t=se,a=re,i="@[a-z-]+",r={className:"variable", +begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS", +case_insensitive:!0,illegal:"[=/|']", +contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n.CSS_NUMBER_MODE,{ +className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{ +className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0 +},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag", +begin:"\\b("+ae.join("|")+")\\b",relevance:0},{className:"selector-pseudo", +begin:":("+a.join("|")+")"},{className:"selector-pseudo", +begin:":(:)?("+t.join("|")+")"},r,{begin:/\(/,end:/\)/, +contains:[n.CSS_NUMBER_MODE]},n.CSS_VARIABLE,{className:"attribute", +begin:"\\b("+oe.join("|")+")\\b"},{ +begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b" +},{begin:/:/,end:/[;}{]/,relevance:0, +contains:[n.BLOCK_COMMENT,r,n.HEXCOLOR,n.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,n.IMPORTANT,n.FUNCTION_DISPATCH] +},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{ +begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/, +keyword:"and or not only",attribute:ie.join(" ")},contains:[{begin:i, +className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute" +},r,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,n.HEXCOLOR,n.CSS_NUMBER_MODE] +},n.FUNCTION_DISPATCH]}},grmr_shell:e=>({name:"Shell Session", +aliases:["console","shellsession"],contains:[{className:"meta.prompt", +begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/, +subLanguage:"bash"}}]}),grmr_sql:e=>{ +const n=e.regex,t=e.COMMENT("--","$"),a=["true","false","unknown"],i=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],s=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],o=r,l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!r.includes(e))),c={ +begin:n.concat(/\b/,n.either(...o),/\s*\(/),relevance:0,keywords:{built_in:o}} +;return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{ +$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:n,when:t}={})=>{const a=t +;return n=n||[],e.map((e=>e.match(/\|\d+$/)||n.includes(e)?e:a(e)?e+"|0":e)) +})(l,{when:e=>e.length<3}),literal:a,type:i, +built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"] +},contains:[{begin:n.either(...s),relevance:0,keywords:{$pattern:/[\w\.]+/, +keyword:l.concat(s),literal:a,type:i}},{className:"type", +begin:n.either("double precision","large object","with timezone","without timezone") +},c,{className:"variable",begin:/@[a-z0-9]+/},{className:"string",variants:[{ +begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,contains:[{ +begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t,{className:"operator", +begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}, +grmr_swift:e=>{const n={match:/\s+/,relevance:0},t=e.COMMENT("/\\*","\\*/",{ +contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,t],i={match:[/\./,p(...ve,...Oe)], +className:{2:"keyword"}},r={match:m(/\./,p(...xe)),relevance:0 +},s=xe.filter((e=>"string"==typeof e)).concat(["_|0"]),o={variants:[{ +className:"keyword", +match:p(...xe.filter((e=>"string"!=typeof e)).concat(ke).map(Ne),...Oe)}]},l={ +$pattern:p(/\b\w+/,/#\w+/),keyword:s.concat(Ae),literal:Me},c=[i,r,o],d=[{ +match:m(/\./,p(...Ce)),relevance:0},{className:"built_in", +match:m(/\b/,p(...Ce),/(?=\()/)}],u={match:/->/,relevance:0},b=[u,{ +className:"operator",relevance:0,variants:[{match:De},{match:`\\.(\\.|${Re})+`}] +}],_="([0-9a-fA-F]_*)+",h={className:"number",relevance:0,variants:[{ +match:"\\b(([0-9]_*)+)(\\.(([0-9]_*)+))?([eE][+-]?(([0-9]_*)+))?\\b"},{ +match:`\\b0x(${_})(\\.(${_}))?([pP][+-]?(([0-9]_*)+))?\\b`},{ +match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},f=(e="")=>({ +className:"subst",variants:[{match:m(/\\/,e,/[0\\tnr"']/)},{ +match:m(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),E=(e="")=>({className:"subst", +match:m(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),y=(e="")=>({className:"subst", +label:"interpol",begin:m(/\\/,e,/\(/),end:/\)/}),w=(e="")=>({begin:m(e,/"""/), +end:m(/"""/,e),contains:[f(e),E(e),y(e)]}),N=(e="")=>({begin:m(e,/"/), +end:m(/"/,e),contains:[f(e),y(e)]}),v={className:"string", +variants:[w(),w("#"),w("##"),w("###"),N(),N("#"),N("##"),N("###")]},O={ +match:m(/`/,Be,/`/)},k=[O,{className:"variable",match:/\$\d+/},{ +className:"variable",match:`\\$${Le}+`}],x=[{match:/(@|#(un)?)available/, +className:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Fe, +contains:[...b,h,v]}]}},{className:"keyword",match:m(/@/,p(...ze))},{ +className:"meta",match:m(/@/,Be)}],M={match:g(/\b[A-Z]/),relevance:0,contains:[{ +className:"type", +match:m(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Le,"+") +},{className:"type",match:$e,relevance:0},{match:/[?!]+/,relevance:0},{ +match:/\.\.\./,relevance:0},{match:m(/\s+&\s+/,g($e)),relevance:0}]},S={ +begin://,keywords:l,contains:[...a,...c,...x,u,M]};M.contains.push(S) +;const A={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",{ +match:m(Be,/\s*:/),keywords:"_|0",relevance:0 +},...a,...c,...d,...b,h,v,...k,...x,M]},C={begin://,contains:[...a,M] +},T={begin:/\(/,end:/\)/,keywords:l,contains:[{ +begin:p(g(m(Be,/\s*:/)),g(m(Be,/\s+/,Be,/\s*:/))),end:/:/,relevance:0, +contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Be}] +},...a,...c,...b,h,v,...x,M,A],endsParent:!0,illegal:/["']/},R={ +match:[/func/,/\s+/,p(O.match,Be,De)],className:{1:"keyword",3:"title.function" +},contains:[C,T,n],illegal:[/\[/,/%/]},D={ +match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"}, +contains:[C,T,n],illegal:/\[|%/},I={match:[/operator/,/\s+/,De],className:{ +1:"keyword",3:"title"}},L={begin:[/precedencegroup/,/\s+/,$e],className:{ +1:"keyword",3:"title"},contains:[M],keywords:[...Se,...Me],end:/}/} +;for(const e of v.variants){const n=e.contains.find((e=>"interpol"===e.label)) +;n.keywords=l;const t=[...c,...d,...b,h,v,...k];n.contains=[...t,{begin:/\(/, +end:/\)/,contains:["self",...t]}]}return{name:"Swift",keywords:l, +contains:[...a,R,D,{beginKeywords:"struct protocol class extension enum actor", +end:"\\{",excludeEnd:!0,keywords:l,contains:[e.inherit(e.TITLE_MODE,{ +className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...c] +},I,L,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0 +},...c,...d,...b,h,v,...k,...x,M,A]}},grmr_typescript:e=>{ +const n=we(e),t=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={ +beginKeywords:"namespace",end:/\{/,excludeEnd:!0, +contains:[n.exports.CLASS_REFERENCE]},i={beginKeywords:"interface",end:/\{/, +excludeEnd:!0,keywords:{keyword:"interface extends",built_in:t}, +contains:[n.exports.CLASS_REFERENCE]},r={$pattern:be, +keyword:me.concat(["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"]), +literal:pe,built_in:ye.concat(t),"variable.language":Ee},s={className:"meta", +begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},o=(e,n,t)=>{ +const a=e.contains.findIndex((e=>e.label===n)) +;if(-1===a)throw Error("can not find mode to replace");e.contains.splice(a,1,t)} +;return Object.assign(n.keywords,r), +n.exports.PARAMS_CONTAINS.push(s),n.contains=n.contains.concat([s,a,i]), +o(n,"shebang",e.SHEBANG()),o(n,"use_strict",{className:"meta",relevance:10, +begin:/^\s*['"]use strict['"]/ +}),n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{ +name:"TypeScript",aliases:["ts","tsx"]}),n},grmr_vbnet:e=>{ +const n=e.regex,t=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,r=/\d{1,2}(:\d{1,2}){1,2}/,s={ +className:"literal",variants:[{begin:n.concat(/# */,n.either(a,t),/ *#/)},{ +begin:n.concat(/# */,r,/ *#/)},{begin:n.concat(/# */,i,/ *#/)},{ +begin:n.concat(/# */,n.either(a,t),/ +/,n.either(i,r),/ *#/)}] +},o=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}] +}),l=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]}) +;return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0, +classNameAliases:{label:"symbol"},keywords:{ +keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield", +built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort", +type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort", +literal:"true false nothing"}, +illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{ +className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/, +end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s,{className:"number",relevance:0, +variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ +},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{ +begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{ +className:"label",begin:/^\w+:/},o,l,{className:"meta", +begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/, +end:/$/,keywords:{ +keyword:"const disable else elseif enable end externalsource if region then"}, +contains:[l]}]}},grmr_wasm:e=>{e.regex;const n=e.COMMENT(/\(;/,/;\)/) +;return n.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/, +keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"] +},contains:[e.COMMENT(/;;/,/$/),n,{match:[/(?:offset|align)/,/\s*/,/=/], +className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{ +match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{ +begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword", +3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/, +className:"type"},{className:"keyword", +match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/ +},{className:"number",relevance:0, +match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/ +}]}},grmr_yaml:e=>{ +const n="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={ +className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/ +},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable", +variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(a,{ +variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),r={ +end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},s={begin:/\{/, +end:/\}/,contains:[r],illegal:"\\n",relevance:0},o={begin:"\\[",end:"\\]", +contains:[r],illegal:"\\n",relevance:0},l=[{className:"attr",variants:[{ +begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{ +begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)"}]},{className:"meta",begin:"^---\\s*$", +relevance:10},{className:"string", +begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{ +begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0, +relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type", +begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t +},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta", +begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)", +relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},{ +className:"number", +begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b" +},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},s,o,a],c=[...l] +;return c.pop(),c.push(i),r.contains=c,{name:"YAML",case_insensitive:!0, +aliases:["yml"],contains:l}}});const je=ne;for(const e of Object.keys(Ue)){ +const n=e.replace("grmr_","").replace("_","-");je.registerLanguage(n,Ue[e])} +return je}() +;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs); \ No newline at end of file diff --git a/Frontend/assets/scripts/tools/highlight.js b/Frontend/assets/scripts/tools/highlight.js new file mode 100644 index 0000000..e1ceb51 --- /dev/null +++ b/Frontend/assets/scripts/tools/highlight.js @@ -0,0 +1,64 @@ +/** + * This file contains scripts needed for syntax highlight to work. + */ + + +/** + * This functions highlight element with provided ID. + * + * @function + * @name highlightSyntax + * @kind function + * @param {any} elementId + * @returns {void} + */ +function highlightSyntax(elementId) { + const element = document.getElementById(elementId); + element.innerHTML = hljs.highlightAuto(element.innerText).value +} + +/** + * Converts pasted data to plain text + * + * @function + * @name configurePastingInElement + * @kind function + * @param {any} elementId + * @returns {void} + */ +function configurePastingInElement(elementId) { + const editorEle = document.getElementById(elementId); + + // Handle the `paste` event + editorEle.addEventListener('paste', function (e) { + // Prevent the default action + e.preventDefault(); + + // Get the copied text from the clipboard + const text = e.clipboardData + ? (e.originalEvent || e).clipboardData.getData('text/plain') + : // For IE + window.clipboardData + ? window.clipboardData.getData('Text') + : ''; + + if (document.queryCommandSupported('insertText')) { + document.execCommand('insertText', false, text); + } else { + // Insert text at the current position of caret + const range = document.getSelection().getRangeAt(0); + range.deleteContents(); + + const textNode = document.createTextNode(text); + range.insertNode(textNode); + range.selectNodeContents(textNode); + range.collapse(false); + + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + } + highlightSyntax(editorEle.id); + + }); +} \ No newline at end of file diff --git a/Frontend/assets/scripts/tools/scripts.js b/Frontend/assets/scripts/tools/scripts.js index db2c22c..9c89779 100644 --- a/Frontend/assets/scripts/tools/scripts.js +++ b/Frontend/assets/scripts/tools/scripts.js @@ -13,8 +13,8 @@ const color_red = "#ff8f8f"; * @returns {void} */ function clearDefaultContent(element, text) { - if (element.value == text) { - element.value = ""; + if (element.innerText == text) { + element.innerText = ""; element.style.color = "#000000"; element.style.backgroundColor = "#ffffff"; } @@ -53,15 +53,40 @@ function getVersion() { * @kind function */ function clearDataField() { - document.getElementById("xmlArea").value = ""; + document.getElementById("xmlArea").innerHTML = ""; document.getElementById("xmlArea").style.color = null; document.getElementById("xmlArea").style.backgroundColor = null; - document.getElementById("transformArea").value = ""; + document.getElementById("transformArea").innerHTML = ""; document.getElementById("transformArea").style.color = null; document.getElementById("transformArea").style.backgroundColor = null; + + document.getElementById("resultArea").innerHTML = ""; } + +/** + * The `escapeHTML` function is used to escape special characters in an HTML element's innerHTML property. + * This is done to prevent these characters from being interpreted as HTML tags or attributes, + * which could potentially cause security vulnerabilities or unintended behavior. + * + * @function + * @name escapeHTML + * @kind function + * @param {any} element + * @returns {void} + */ +function escapeHTML(elementID) { + document.getElementById(elementID).innerHTML = document.getElementById(elementID).innerHTML + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + + + /** * It fills the XML area with a sample XML. * @@ -78,12 +103,50 @@ function fillDefaultXML(element) { fetch(serverAddress + "/assets/samples/sampleXml.xml") .then(response => response.text()) .then((exampleData) => { - document.getElementById("xmlArea").value = exampleData; + document.getElementById("xmlArea").innerText = exampleData; + highlightSyntax("xmlArea"); document.getElementById("xmlArea").style.backgroundColor = null; + }) } } +function fillDefaultXSD(){ + const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086"; + fetch(serverAddress + "/assets/samples/sampleXSD.xsd") + .then( response => response.text() ) + .then( (XSDSchema) => { + document.getElementById('transformArea').innerText = XSDSchema; + highlightSyntax("transformArea"); + } ) + fetch(serverAddress + "/assets/samples/sampleXMLForXSD.xml") + .then( response => response.text() ) + .then( (XMLSample) => { + document.getElementById('xmlArea').innerText = XMLSample; + highlightSyntax("xmlArea"); + } ) + +} + + +/** + * The `fillDefaultXSLT()` function fetches a default XSLT template from the server and sets the value of the element with id "transformArea" to the fetched template. + * + * @function + * @name fillDefaultXSLT + * @kind function + * @returns {void} + */ +function fillDefaultXSLT() { + const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086"; + fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt") + .then( response => response.text() ) + .then( (XSTLTemplate) => { + document.getElementById('transformArea').innerText = XSTLTemplate; + highlightSyntax("transformArea"); + } ) +} + /** * It sets default content for the element an changes it's color to grey * @@ -223,8 +286,8 @@ function refreshTooltip() { function performRequest(endpoint, checkXML, checkTransform) { const sourceId = "xmlArea"; const transformId = "transformArea"; - var xmlData = document.getElementById(sourceId).value.trim(); - var transformData = document.getElementById(transformId).value.trim(); + var xmlData = document.getElementById(sourceId).innerText.trim(); + var transformData = document.getElementById(transformId).innerText.trim(); var port = 8081; if (getProcessor() == "libxml") { @@ -243,17 +306,24 @@ function performRequest(endpoint, checkXML, checkTransform) { } if (!empty) { restRequest(port, endpoint, xmlData, transformData).then(function (result) { - document.getElementById("resultArea").value = result.result; - document.getElementById("procinfo").innerText = ' Computed using '.concat(" ", result.processor); - if (result.status = "OK") { - document.getElementById("procinfo").innerText = document.getElementById("procinfo").innerText.concat(" in ", result.time, "ms"); + document.getElementById("resultArea").innerText = result.result; + highlightSyntax("resultArea"); + document.getElementById("procinfo").innerText = ' Computed using ' + result.processor; + + + if (result.status == "OK") { + document.getElementById("procinfo").innerText += " (" + result.time + "ms)"; + if (result.type) + document.getElementById("procinfo").innerText += ". Returned: " + result.type; + else + document.getElementById("procinfo").innerText += ". Engine doesn't support return of data types."; procinfo.style.color = "#30aa58"; } else { procinfo.style.color = "#aa3030"; } }); } else { - document.getElementById("resultArea").value = "No data provided!"; + document.getElementById("resultArea").innerHTML = "No data provided!"; return false; } @@ -276,7 +346,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) { const targetElement = document.getElementById(targetId); const infoElement = document.getElementById("formatinfo"); const port = 8082; - var xmlData = sourceElement.value.trim(); + var xmlData = sourceElement.innerText.trim(); var empty = false; if (defaultStrings.includes(xmlData) && checkXML) { @@ -288,10 +358,13 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) { if (!empty) { restRequest(port, endpoint, xmlData, "").then(function (result) { if (result.status == "OK") { - targetElement.value = result.result; + targetElement.innerText = result.result.trim(); + highlightSyntax(targetElement.id); + targetElement.style.backgroundColor = null; infoElement.innerText = ' Computed'.concat(" in ", result.time, "ms."); infoElement.style.color = "#30aa58"; + } else { targetElement.style.backgroundColor = color_red; @@ -302,6 +375,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) { }); } + } @@ -350,4 +424,4 @@ async function restRequest(port, endpoint, xmlData, transformData) { }); return result; -} +} \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html index 4dd6c42..abb8dbe 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -2,14 +2,19 @@ - - + + Release11 Web Tools + + + + @@ -43,7 +48,9 @@ Copyright © 2023
Release11 Sp. z. o. o.
Terms of use
- Privacy statement + Privacy statement
+
+ Found a bug?
diff --git a/Frontend/nginx.conf b/Frontend/nginx.conf new file mode 100644 index 0000000..e52fbb2 --- /dev/null +++ b/Frontend/nginx.conf @@ -0,0 +1,24 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + expires -1; + add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + +} \ No newline at end of file diff --git a/Frontend/tools/jsonFormatter.html b/Frontend/tools/jsonFormatter.html index d0e18b4..300ff95 100644 --- a/Frontend/tools/jsonFormatter.html +++ b/Frontend/tools/jsonFormatter.html @@ -6,14 +6,15 @@ - + + - +
@@ -224,38 +225,11 @@ hljs.addPlugin(mergeHTMLPlugin); - const editorEle = document.getElementById('jsonBlock'); - - // Handle the `paste` event - editorEle.addEventListener('paste', function (e) { - // Prevent the default action - e.preventDefault(); - - // Get the copied text from the clipboard - const text = e.clipboardData - ? (e.originalEvent || e).clipboardData.getData('text/plain') - : // For IE - window.clipboardData - ? window.clipboardData.getData('Text') - : ''; - - if (document.queryCommandSupported('insertText')) { - document.execCommand('insertText', false, text); - } else { - // Insert text at the current position of caret - const range = document.getSelection().getRangeAt(0); - range.deleteContents(); - - const textNode = document.createTextNode(text); - range.insertNode(textNode); - range.selectNodeContents(textNode); - range.collapse(false); - - const selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - } - }); + function init() { + // Make sure that only plain text is pasted + configurePastingInElement("jsonBlock"); + + } diff --git a/Frontend/tools/xmlFormatter.html b/Frontend/tools/xmlFormatter.html index 02a23d4..c9419ea 100644 --- a/Frontend/tools/xmlFormatter.html +++ b/Frontend/tools/xmlFormatter.html @@ -4,7 +4,12 @@ + + + + + @@ -34,10 +39,7 @@
- +


@@ -70,7 +72,7 @@ } function init() { - setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here'); + configurePastingInElement("xmlArea"); } diff --git a/Frontend/tools/xpath.html b/Frontend/tools/xpath.html index 56db7a2..b7726d4 100644 --- a/Frontend/tools/xpath.html +++ b/Frontend/tools/xpath.html @@ -2,10 +2,13 @@ - - - + + + + + + @@ -29,7 +32,7 @@
-

+
+
- +

-

+
- +

What is XPath?

-

XPath is a query language used for selecting nodes from XML and processing them.
- It may perform operations on strings, numbers and boolean values.

+

+ XPath is a query language used for selecting nodes from XML and processing them.
+ It may perform operations on strings, numbers and boolean values.
+

+

+

Semantics legend:

+

+ "+" - 1 or more elements +

+

+ "*" - 0 or more elements +

+

+ "?" - optional element +

+

- +

XPath 2.0 introduced many new features XQuery-cośtam:
@@ -110,148 +121,346 @@ - - -

- - - -
- - - [1.0] fn:last() + +
+ + +
-
- Returns the position of the last node in the context list
+ fn:position() +
+ Returns the position of the current context node.

W3C Documentation reference: Node-Set-Functions
-
- - - [1.0] fn:position() -
-
- Returns the position of the current context node
+ + fn:last() +
+ The last function returns a number equal to the context size from the expression evaluation context.

W3C Documentation reference: Node-Set-Functions
-
- - - - [1.0] fn:count(node-set) -
-
- Returns the number of nodes in the node-set
- Arguments and return type: - - - - - - - - - -
TypeDescription
node-setNode-set to count nodes in
Examples:
- - - - - - - - - - - - - -
ExpressionResult
count(//b:book)5
count(//person[@id>5])17

- W3C Documentation reference: Node-Set-Functions + + + fn:count() +
+ Returns the number of nodes in the node-set
+ Arguments: + + + + + + + + + +
TypeDescription
node-setNode-set to count nodes in
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
count(//b:book)5
count(//person[@id>5])17

+ W3C Documentation reference: Node-Set-Functions
-
- - - - [1.0] fn:id(object) -
-
+ + + + fn:id() +
Returns the element specified by it's unique id, requires DTD

W3C Documentation reference: Node-Set-Functions
-
- - - - [1.0] fn:local-name(node-set) -
-
- Returns the local-name for the first node in the node-set
- Arguments and return type: - - - - - - - - - -
TypeDescription
node-setExtract first node and return its local name
Examples:
- - - - - - - - - - - - - -
ExpressionResult
local-name(//b:books)b:book
local-name(//b:book)b:title

- W3C Documentation reference: Node-Set-Functions + + + + fn:local-name() +
+ Returns the local-name for the first node in the node-set
+ Arguments: + + + + + + + + + +
TypeDescription
node-setExtract first node and return its local name
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
local-name(//b:books)b:book
local-name(//b:book)b:title

+ W3C Documentation reference: Node-Set-Functions
+ + + fn:namespace-uri() +
+ Returns the namespace-uri for the first node in the node-set
+ Arguments: + + + + + + + + + +
TypeDescription
node-setExtract first node and return the namespace URI
Examples:
+ + + + + + + + + +
ExpressionResult
namespace-uri(//b:book)http://www.book.com

+ W3C Documentation reference: Node-Set-Functions +
+ + + fn:name() +
+ Returns the name for the first node in the node-set
+ Arguments: + + + + + + + + + +
TypeDescription
node-set (Optional)Extract first node and return QName
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
name(//b:books/*)b:book
name(//b:book/*)b:title

+ W3C Documentation reference: Node-Set-Functions +
+
- - - - [1.0] fn:local-name() +
+
+ + +
-
- Returns the local-name for the context node
+ + + fn:boolean() +
+ The boolean function converts its argument to a boolean as follows: +
    +
  • a number is true if and only if it is neither positive or negative zero nor NaN
  • +
  • a node-set is true if and only if it is non-empty
  • +
  • a string is true if and only if its length is non-zero
  • +
  • an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type
  • +
+ + Arguments: + + + + + + + + + +
TypeDescription
objectThe object to convert to a boolean
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
boolean("Release11")true
boolean("")false

+ W3C Documentation reference: Boolean-Functions +
+ + fn:not() +
+ The not function returns true if its argument is false, and false otherwise.
+
+ W3C Documentation reference: Boolean-Functions +
+ + + fn:true() +
+ The true function returns true.
+
+ W3C Documentation reference: Boolean-Functions +
+ + + fn:false() +
+ The true function returns false.
+
+ W3C Documentation reference: Boolean-Functions +
+ + fn:lang() +
+ The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the xml:lang attribute on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the context node that has an xml:lang attribute. If there is no such attribute, then lang returns false. If there is such an attribute, then lang returns true if the attribute value is equal to the argument ignoring case, or if there is some suffix starting with - such that the attribute value is equal to the argument ignoring that suffix of the attribute value and ignoring case.
+ Arguments: + + + + + + + + + +
TypeDescription
stringLanguage that will be looked for in context node
Examples: Look W3C documentation

- W3C Documentation reference: Node-Set-Functions + W3C Documentation reference: Boolean-Functions
+ +
- - - - [1.0] fn:namespace-uri(node-set) +
+
+ + +
-
- Returns the namespace-uri for the first node in the node-set
- Arguments and return type: + + fn:string() +
+ The string function converts an object to a string as follows: A node-set is converted to a string by returning the string-value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.
+ + Arguments: + + + + + + + + + +
TypeDescription
objectThe object to convert to a string
Examples:
+ + + + + + + + + +
ExpressionResult
string(10)true

+ W3C Documentation reference: String-Functions +
+ + + fn:concat() +
+ The concat function returns the concatenation of its arguments.
+ + Arguments: + + + + + + + + + +
TypeDescription
string*Strings to concatenate
Examples:
+ + + + + + + + + +
ExpressionResult
concat("Release", 11)Release11

+ W3C Documentation reference: String-Functions +
+ + fn:starts-with() +
+ Returns true if the first argument string starts with the second argument string, and otherwise returns false.
+ + Arguments: - - + + + + + +
Type Description
node-setExtract first node and return the namespace URIstringString to test
stringString that first string has to start from
Examples:
@@ -260,69 +469,1070 @@ - - + +
Result
namespace-uri(//b:book)http://www.book.comstarts-with("Release11", "Rel")true

- W3C Documentation reference: Node-Set-Functions + W3C Documentation reference: String-Functions
+ + fn:contains() +
+ The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.
+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
stringString to test
stringString that first string has to contain
Examples:
+ + + + + + + + + +
ExpressionResult
contains("Release11", "eas")true

+ W3C Documentation reference: String-Functions +
+ + fn:substring-before() +
+ The substring-before function returns the substring of the first argument string that precedes the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.
+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
stringString to test
stringString that first string has to contain
Examples:
+ + + + + + + + + +
ExpressionResult
substring-before("1999/04/01","/")1999

+ W3C Documentation reference: String-Functions +
+ + + fn:substring-after() +
+ The substring-after function returns the substring of the first argument string that follows the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.
+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
stringString to test
stringString that first string has to contain
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
substring-after("1999/04/01","/")04/01
substring-after("1999/04/01","19")99/04/01

+ W3C Documentation reference: String-Functions +
+ + + fn:substring() +
+ The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument.
+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
stringString to test
numberStarting index
number?Length of target substring
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
substring("12345",2)2345
substring("12345",2,3)234

+ W3C Documentation reference: String-Functions +
+ + fn:string-length() +
+ The string-length returns the number of characters in the string. If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node.
+ + Arguments: + + + + + + + + + +
TypeDescription
string?String to test
Examples:
+ + + + + + + + + +
ExpressionResult
string-length("abcdef")6

+ W3C Documentation reference: String-Functions +
+ + fn:normalize-space() +
+ The normalize-space function returns the argument string with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. Whitespace characters are the same as those allowed by the S production in XML. If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node.
+ + Arguments: + + + + + + + + + +
TypeDescription
string?String to test
Examples:
+ + + + + + + + + +
ExpressionResult
normalize-space(" abc def ")abc def

+ W3C Documentation reference: String-Functions +
+ + + fn:translate() +
+ The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed.
+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
stringString to translate
stringCharacters to remove
stringString to insert characters from second argument
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
translate("bar","abc","ABC")BAr
translate("--aaa--","abc-","ABC")AAA

+ W3C Documentation reference: String-Functions +
+ +
- - - - [1.0] fn:namespace-uri() +
+
+ + +
-
- Returns the namespace-uri for the context node
+ + + fn:number() +
+ The number function converts its argument to a number as follows: +
    +
  • a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN
  • +
  • boolean true is converted to 1; boolean false is converted to 0
  • +
  • a node-set is first converted to a string as if by a call to the string function and then converted in the same way as a string argument
  • +
  • an object of a type other than the four basic types is converted to a number in a way that is dependent on that type
  • +
+ + Arguments: + + + + + + + + + +
TypeDescription
objectThe object to convert to a number
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
number(10)10
number("")NaN

+ W3C Documentation reference +
+ + fn:sum() +
+ The sum function returns the sum, for each node in the argument node-set, of the result of converting the string-values of the node to a number.
+ + Arguments: + + + + + + + + + +
TypeDescription
node-setNode set to sum
Examples:
+ + + + + + + + + +
ExpressionResult
sum(/l:library/l:readerList/p:person/p:readerID)12444

+ W3C Documentation reference +
+ + fn:floor() +
+ The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.
+ + Arguments: + + + + + + + + + +
TypeDescription
node-setNode set to sum
Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
floor(3.1)4
floor(3.9)4
floor(3.5)4

+ W3C Documentation reference +
+ + fn:ceiling() +
+ The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.
+ + Arguments: + + + + + + + + + +
TypeDescription
node-setNode set to sum
Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
floor(3.1)3
floor(3.9)3
floor(3.5)3

+ W3C Documentation reference +
+ + + fn:round() +
+ The round function returns the number that is closest to the argument and that is an integer. If there are two such numbers, then the one that is closest to positive infinity is returned. If the argument is NaN, then NaN is returned. If the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. 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, but greater than or equal to -0.5, then negative zero is returned. + +

NOTE

+ For these last two cases, the result of calling the round function is not the same as the result of adding 0.5 and then calling the floor function.
+ + Arguments: + + + + + + + + + +
TypeDescription
node-setNode set to sum
Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
floor(3.1)3
floor(3.9)4
floor(3.5)3

+ W3C Documentation reference +
+ +
+
+ + +
+ + + +
+ + + fn:name() +
+ Returns the name of a node, as an xs:string that is either the zero-length string, or + has the lexical form of an xs:QName.
+ + If the argument is omitted, it defaults to the context item (.). 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 following errors may be raised: if the context item is undefined [err:XPDY0002]XP; + if the context item is not a node [err:XPTY0004]XP.
+ + If the argument is supplied and is the empty sequence, the function returns the + zero-length string.
+ + If the target node has no name (that is, if it is a document node, a comment, a text + node, or a namespace binding having no name), the function returns the zero-length + string.
+ + Otherwise, the value returned is fn:string(fn:node-name($arg)).

- W3C Documentation reference: Node-Set-Functions -
-
- - - - [1.0] fn:name(node-set) -
-
- Returns the name for the first node in the node-set
- Arguments and return type: + Arguments: - - + + -
Type Description
node-setExtract first node and return QNamenode?Node to display name.
Examples:
+ + Return type: xs:string

+ + Examples: - + - - - - - - + +
ExpressionQuery Result
name(//b:books/*)b:book
name(//b:book/*)b:titlename(/l:library)l:library

- W3C Documentation reference: Node-Set-Functions + W3C Documentation reference
+ + fn:local-name() +
+ Returns the local part of the name of $arg as an xs:string that will either be the + zero-length string or will have the lexical form of an xs:NCName.
+ + If the argument is omitted, it defaults to the context item (.). 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 following errors may be raised: if the context item is undefined [err:XPDY0002]XP; + if the context item is not a node [err:XPTY0004]XP.
+ + If the argument is supplied and is the empty sequence, the function returns the + zero-length string.
+ + If the target node has no name (that is, if it is a document node, a comment, or a text + node), the function returns the zero-length string.
+ + Otherwise, the value returned will be the local part of the expanded-QName of the target + node (as determined by the dm:node-name accessor in Section 5.11 node-name Accessor). + This will be an xs:string whose lexical form is an xs:NCName.
+ +
+ Arguments: + + + + + + + + + +
TypeDescription
node?Node to display local-name.
+ Return type: xs:string

+ Examples: + + + + + + + + + +
QueryResult
name(/l:library)library

+ + W3C Documentation reference +
+ + fn:nilled() +
+ Returns an xs:boolean indicating whether the argument node is "nilled". If the argument + is not an element node, returns the empty sequence. If the argument is the empty + sequence, returns the empty sequence.
+ +
+ Arguments: + + + + + + + + + +
TypeDescription
node?Node to test.
+ Return type: xs:boolean?

+ Examples: + + + + + + + + + +
QueryResult
nilled(/l:library)false

+ + W3C Documentation reference +
+ + fn:base-uri() +
+ Returns the value of the base-uri URI property for $arg as defined by the accessor + function dm:base-uri() for that kind of node in Section 5.2 base-uri AccessorDM. If $arg + is not specified, the behavior is identical to calling the function with the context + item (.) as argument. The following errors may be raised: if the context item is + undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
+ + If $arg is the empty sequence, the empty sequence is returned.
+ + Document, element and processing-instruction nodes have a base-uri property which may be + empty. The base-uri property of all other node types is the empty sequence. The value of + the base-uri property is returned if it exists and is not empty. Otherwise, if the node + has a parent, the value of dm:base-uri() applied to its parent is returned, recursively. + If the node does not have a parent, or if the recursive ascent up the ancestor chain + encounters a node whose base-uri property is empty and it does not have a parent, the + empty sequence is returned.
+ +
+ Arguments: + + + + + + + + + +
TypeDescription
node?Node to find base URI of.
+ Return type: xs:anyURI?

+ Examples: + + + + + + + + + +
QueryResult
base-uri(/l:library/l:libraryName)<empty sequence>

+ + W3C Documentation reference +
+ + fn:document-uri() +
+ Returns the value of the document-uri property for $arg as defined by the + dm:document-uri accessor function defined in Section 6.1.2 AccessorsDM.
+ + If $arg is the empty sequence, the empty sequence is returned.
+ + Returns the empty sequence if the node is not a document node. Otherwise, returns the + value of the dm:document-uri accessor of the document node.
+ + In the case of a document node $D returned by the fn:doc function, or a document node at + the root of a tree containing a node returned by the fn:collection function, it will + always be true that either fn:document-uri($D) returns the empty sequence, or that the + following expression is true: fn:doc(fn:document-uri($D)) is $D. 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.
+ +
+ Arguments: + + + + + + + + + +
TypeDescription
node?Node which document-uri value needs to be returned.
+ Return type: xs:anyURI?

+ Examples: + + + + + + + + + + + + + + + + + +
QueryResult
document-uri(/l:library/l:libraryName)<empty sequence>
document-uri(/library/fiction:book[1])http://example.com/library.xml (assuming the document URI of the first + fiction:book element is "http://example.com/library.xml")
document-uri(/library)http://example.com/library.xml (assuming the document URI of the library + element is "http://example.com/library.xml")

+ + W3C Documentation reference +
+ + fn:lang() +
+ This function tests whether the language of $node, or the context item if the second + argument is omitted, as specified by xml:lang attributes is the same as, or is a + sublanguage of, the language specified by $testlang. The behavior of the function if the + second argument is omitted is exactly the same as if the context item (.) had been + passed as the second argument. The language of the argument node, or the context item if + the second argument is omitted, is determined by the value of the xml:lang attribute on + the node, or, if the node has no such attribute, by the value of the xml:lang attribute + on the nearest ancestor of the node that has an xml:lang attribute. If there is no such + ancestor, then the function returns false

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:string?$testlang
node()$node (Optional)
+ Return type: xs:boolean?

+ Examples: Look W3C documentation below. +
+ + W3C Documentation reference +
+ + fn:root() +
+ Returns the root of the tree to which $arg belongs. This will usually, but not + necessarily, be a document node.
+ + If $arg is the empty sequence, the empty sequence is returned.
+ + If $arg is a document node, $arg is returned.
+ + If the function is called without an argument, the context item (.) 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 following errors may be raised: if the context item is undefined [err:XPDY0002]; if + the context item is not a node [err:XPTY0004].

+ + Arguments: + + + + + + + + + +
TypeDescription
node()$arg (Optional)
+ Return type: node()?

+ Examples: + + + + + + + + + +
QueryResult
root()<l:library>[...]</l:library>

+ + W3C Documentation reference +
+ + fn:count() +
+ Returns the number of items in the value of $arg. Returns 0 if $arg is the empty + sequence.

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: xs:integer

+ Examples: + + + + + + + + + + + + + +
QueryResult
count(/l:library/l:readerList/p:person)2
count(/l:library/l:writers)0

+ + W3C Documentation reference +
+ + + fn:avg() +
+ Returns the number of items in the value of $arg. Returns 0 if $arg is the empty + sequence.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:anyAtomicType*$arg
+ Return type: xs:anyAtomicType

+ Examples: + + + + + + + + + +
QueryResult
avg(/l:library/l:readerList/p:person/p:readerID)6222

+ + W3C Documentation reference +
+ + + fn:max() +
+ Selects an item from the input sequence $arg whose value is greater than or equal to the + value of every other item in the input sequence. If there are two or more such items, + then the specific item whose value is returned is ·implementation dependent·.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*$arg
xs:string$collation (Optional)
+ Return type: xs:anyAtomicType?

+ Examples: + + + + + + + + + + + + + +
QueryResult
max((3,4,5))5
max((5, 5.0e0))5.0e0

+ + W3C Documentation reference +
+ + fn:min() +
+ Selects an item from the input sequence $arg whose value is less than or equal to the + value of every other item in the input sequence. If there are two or more such items, + then the specific item whose value is returned is ·implementation dependent·.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*$arg
xs:string$collation (Optional)
+ Return type: xs:anyAtomicType?

+ Examples: + + + + + + + + + + + + + +
QueryResult
min((3,4,5))3
min((5, 5.0e0))5.0e0

+ + W3C Documentation reference +
+ + + fn:sum() +
+ Returns a value obtained by adding together the values in $arg. If $zero is not + specified, then the value returned for an empty sequence is the xs:integer value 0. If + $zero is specified, then the value returned for an empty sequence is $zero.
+ + Any values of type xs:untypedAtomic in $arg are cast to xs:double. The items in the + resulting sequence may be reordered in an arbitrary order. The resulting sequence is + referred to below as the converted sequence.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*$arg
xs:anyAtomicType?$zero (Optional)
+ Return type: xs:anyAtomicType?

+ Examples: + + + + + + + + + +
QueryResult
sum(/l:library/l:readerList/p:person/p:readerID)12444

+ + W3C Documentation reference +
+
- - - - [1.0] fn:name() +
+
+ + +
-
- Returns the name for the context node
+ + + fn:boolean() +
+ Computes the effective boolean value of the sequence $arg. See Section 2.4.3 Effective + Boolean ValueXP
+ + If $arg is the empty sequence, fn:boolean returns false.
+ + If $arg is a sequence whose first item is a node, fn:boolean returns true.
+ + If $arg is a singleton value of type xs:boolean or a derived from xs:boolean, fn:boolean + returns $arg.
+ + If $arg is a singleton value of type xs:string or a type derived from xs:string, + xs:anyURI or a type derived from xs:anyURI or xs:untypedAtomic, fn:boolean returns false + if the operand value has zero length; otherwise it returns true.
+ + If $arg is a singleton value of any numeric type or a type derived from a numeric type, + fn:boolean returns false if the operand value is NaN or is numerically equal to zero; + otherwise it returns true. + + In all other cases, fn:boolean raises a type error [err:FORG0006].
+ + The static semantics of this function are described in Section 7.2.4 The fn:boolean and + fn:not functionsFS.

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: xs:boolean?

+ Examples: + + + + + + + + + + + + + + + + + +
QueryResult
boolean("/l:library")true
boolean(0)false
boolean(())false

+ + W3C Documentation reference +
+ + + fn:true() +
+ Returns the xs:boolean value true. Equivalent to xs:boolean("1").

+ + Return type: xs:boolean

Examples:
@@ -330,36 +1540,41 @@ - - + +
Result
current context nodeExtract first node and return QNametrue()true

- W3C Documentation reference: Node-Set-Functions + W3C Documentation reference
-
+ fn:false() +
+ Returns the xs:boolean value false. Equivalent to xs:boolean("0").

+ Return type: xs:boolean

+ Examples:
+ + + + + + + + + +
ExpressionResult
false()false

+ W3C Documentation reference +
-
-
-
- - - -
- - - [1.0] fn:boolean(object) -
-
- The boolean function converts its argument to a boolean as follows: -
    -
  • a number is true if and only if it is neither positive or negative zero nor NaN
  • -
  • a node-set is true if and only if it is non-empty
  • -
  • a string is true if and only if its length is non-zero
  • -
  • an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type
  • -
+ fn:not() +
+ $arg is first reduced to an effective boolean value by applying the fn:boolean() + function. Returns true if the effective boolean value is false, and false if the + effective boolean value is true.

Arguments and return type: @@ -368,67 +1583,56 @@ - - + + -
Description
objectThe object to convert to a booleanitem$arg
Examples:
+ + Return type: xs:boolean

+ Examples:
- + - +
Expression Result
boolean("Release11")not(false()) true
boolean("")not(true()) false

- W3C Documentation reference: Boolean-Functions + W3C Documentation reference
+ +
- - - - [1.0] fn:not() +
+
+ + +
-
- The not function returns true if its argument is false, and false otherwise.
-
- W3C Documentation reference: Boolean-Functions -
-
+ fn:string(object) +
+ Returns the value of $arg represented as a xs:string. If no argument is supplied, the + context item (.) 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.
- [1.0] fn:true() -
-
- The true function returns true.
-
- W3C Documentation reference: Boolean-Functions -
-
+ If the context item is undefined, error [err:XPDY0002]XP is raised.
+ If $arg is the empty sequence, the zero-length string is returned.
- [1.0] fn:false() -
-
- The true function returns false.
-
- W3C Documentation reference: Boolean-Functions -
-
+ If $arg is a node, the function returns the string-value of the node, as obtained using + the dm:string-value accessor defined in the Section 5.13 string-value AccessorDM.
- [1.0] fn:lang(string) -
-
- The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the xml:lang attribute on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the context node that has an xml:lang attribute. If there is no such attribute, then lang returns false. If there is such an attribute, then lang returns true if the attribute value is equal to the argument ignoring case, or if there is some suffix starting with - such that the attribute value is equal to the argument ignoring that suffix of the attribute value and ignoring case.
+ If $arg is an atomic value, then the function returns the same string as is returned by + the expression " $arg cast as xs:string " (see 17 Casting).
Arguments and return type: @@ -437,28 +1641,5865 @@ - + -
stringLanguage that will be looked for in context nodeThe object to convert to a string
Examples: Look W3C documentation
-
- W3C Documentation reference: Boolean-Functions + + Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
string((1<0))false
string(.11)0.11

+ W3C Documentation reference +
+ + fn:codepoints-to-string() +
+ Creates an xs:string from a sequence of The Unicode Standard code points. Returns the + zero-length string if $arg is the empty sequence. If any of the code points in $arg is + not a legal XML character, an error is raised [err:FOCH0001].
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:integer*$arg
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
codepoints-to-string((2309, 2358, 2378, 2325))अशॊक
codepoints-to-string((40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41)) + ( ͡° ͜ʖ ͡°)

+ W3C Documentation reference +
+ + fn:string-to-codepoints() +
+ Returns the sequence of The Unicode Standard code points that constitute an xs:string. + If $arg is a zero-length string or the empty sequence, the empty sequence is + returned.
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string*$arg
+ Return type: xs:integer*

+ Examples:
+ + + + + + + + + +
ExpressionResult
string-to-codepoints("Thérèse")(84, 104, 233, 114, 232, 115, 101)

+ W3C Documentation reference +
+ + fn:compare() +
+ Returns -1, 0, or 1, depending on whether the value of the $comparand1 is respectively + less than, equal to, or greater than the value of $comparand2, according to the rules of + the collation that is used.
+ + The collation used by the invocation of this function is determined according to the + rules in 7.3.1 Collations.
+ + If either argument is the empty sequence, the result is the empty sequence.
+ + This function, invoked with the first signature, backs up the "eq", "ne", "gt", "lt", + "le" and "ge" operators on string values.
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$comparand1
xs:string?$comparand2
xs:string$collation (Optional)
+ Return type: xs:integer*

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
compare('abc', 'abc')0
compare('abc', 'acc')-1
compare('abc', 'acc')1

+ W3C Documentation reference +
+ + fn:codepoint-equal() +
+ Returns true or false depending on whether the value of $comparand1 is equal to the + value of $comparand2, according to the Unicode code + point collation.
+ + If either argument is the empty sequence, the result is the empty sequence.
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?$comparand1
xs:string?$comparand2
+ Return type: xs:boolean?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
codepoint-equal("asdf", "asdf")true
codepoint-equal("asdf", "asdf ")false

+ W3C Documentation reference +
+ + fn:concat() +
+ Accepts two or more xs:anyAtomicType arguments and casts them to xs:string. Returns the + xs:string that is the concatenation of the values of its arguments after conversion. If + any of the arguments is the empty sequence, the argument is treated as the zero-length + string.
+ + The fn:concat 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].
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType?$arg1
xs:anyAtomicType?$arg2
xs:anyAtomicType?$arg... (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
concat('un', 'grateful')ungrateful
concat('Thy ', (), 'old ', "groans", "", ' ring', ' yet', ' in', ' my', ' + ancient',' ears.')Thy old groans ring yet in my ancient ears.
fn:concat('Ciao!',())Ciao!

+ W3C Documentation reference +
+ + fn:string-join() +
+ Returns a xs:string created by concatenating the members of the $arg1 sequence using + $arg2 as a separator. If the value of $arg2 is the zero-length string, then the members + of $arg1 are concatenated without a separator.
+ + If the value of $arg1 is the empty sequence, the zero-length string is returned.
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*$arg1
xs:string$arg2
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
string-join(('Now', 'is', 'the', 'time', '...'), ' ')Now is the time ...
string-join(('Blow, ', 'blow, ', 'thou ', 'winter ', 'wind!'), '')Blow, blow, thou winter wind!

+ W3C Documentation reference +
+ + fn:substring() +
+ Returns the portion of the value of $sourceString beginning at the position indicated by + the value of $startingLoc and continuing for the number of characters indicated by the + value of $length. The characters returned do not extend beyond $sourceString. If + $startingLoc 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 + $sourceString whose position $p obeys:
+ fn:round($startingLoc) <= $p < fn:round($startingLoc) + fn:round($length)
+ The two argument version of the function assumes that $length is infinite and returns + the characters in $sourceString whose position $p obeys:
+ fn:round($startingLoc) <= $p < fn:round(INF)
+ In the above computations, the rules for op:numeric-less-than() and + op:numeric-greater-than() apply.
+ If the value of $sourceString is the empty sequence, the zero-length string is + returned.
+ + Note:
+ The first character of a string is located at position 1, not position 0.
+ + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$sourceString
xs:double$startingLoc
xs:double$length (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
substring("motor car", 6)" car"
substring("metadata", 4, 3)ada

+ W3C Documentation reference +
+ + fn:string-length() +
+ Returns an xs:integer equal to the length in characters of the value of $arg.
+ + If the value of $arg is the empty sequence, the xs:integer 0 is returned.
+ + If no argument is supplied, $arg defaults to the string value (calculated using + fn:string()) of the context item (.). If no argument is supplied and the context item is + undefined an error is raised: [err:XPDY0002].
+ + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$arg (Optional)
+ Return type: xs:integer

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
string-length("Harp not on that string, madam; that is past.")45
string-length(())0

+ W3C Documentation reference +
+ + fn:normalize-space() +
+ Returns the value of $arg with whitespace normalized by stripping leading and trailing + whitespace and replacing sequences of one or more than one whitespace character with a + single space, #x20.
+ + If the value of $arg is the empty sequence, returns the zero-length string.
+ + If no argument is supplied, then $arg defaults to the string value (calculated using + fn:string()) of the context item (.). If no argument is supplied and the context item is + undefined an error is raised: [err:XPDY0002].
+ + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$arg (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
normalize-space(" The wealthy curled darlings of our nation. ")The wealthy curled darlings of our nation.
normalize-space(())""

+ W3C Documentation reference +
+ + fn:normalize-unicode() +
+ Returns the value of $arg normalized according to the normalization criteria for a + normalization form identified by the value of $normalizationForm. The effective value of + the $normalizationForm is computed by removing leading and trailing blanks, if present, + and converting to upper case.
+ + If the value of $arg is the empty sequence, returns the zero-length string.
+ + Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg
xs:string$normalizationForm (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + +
ExpressionResult
normalize-unicode("test ")test

+ W3C Documentation reference +
+ + fn:upper-case() +
+ Returns the value of $arg 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.
+ + If the value of $arg is the empty sequence, the zero-length string is returned.
+ + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$arg
+ Return type: xs:string

+ Examples:
+ + + + + + + + + +
ExpressionResult
upper-case("abCd0")ABCD0

+ W3C Documentation reference +
+ + fn:lower-case() +
+ Returns the value of $arg 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.
+ + If the value of $arg is the empty sequence, the zero-length string is returned.
+ + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$arg
+ Return type: xs:string

+ Examples:
+ + + + + + + + + +
ExpressionResult
lower-case("abCd0")abcd0

+ W3C Documentation reference +
+ + fn:translate() +
+ Returns the value of $arg modified so that every character in the value of $arg that + occurs at some position N in the value of $mapString has been replaced by the character + that occurs at position N in the value of $transString.
+ + If the value of $arg is the empty sequence, the zero-length string is returned.
+ + Every character in the value of $arg that does not appear in the value of $mapString is + unchanged.
+ + Every character in the value of $arg that appears at some position M in the value of + $mapString, where the value of $transString is less than M characters in length, is + omitted from the returned value. If $mapString is the zero-length string $arg is + returned.
+ + If a character occurs more than once in $mapString, then the first occurrence determines + the replacement character. If $transString is longer than $mapString, the excess + characters are ignored.
+ + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg
xs:string$mapString
xs:string$mapString
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
translate("bar","abc","ABC")BAr
translate("--aaa--","abc-","ABC")AAA
translate("abcdabc", "abc", "AB")ABdAB

+ W3C Documentation reference +
+ + fn:encode-for-uri() +
+ This function encodes reserved characters in an xs:string that is intended to be used in + the path segment of a URI. It is invertible but not idempotent. This function applies + the URI escaping rules defined in section 2 of [RFC 3986] to the xs:string supplied as + $uri-part. 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].
+ + If $uri-part is the empty sequence, returns the zero-length string.
+ + All 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 "~".
+ + Note that this function escapes URI delimiters and therefore cannot be used + indiscriminately to encode "invalid" characters in a path segment.
+ + 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.
+ + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$uri-part
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
encode-for-uri("https://www.google.com")"https%3A%2F%2Fwww.
google.com"
concat("http://www.example.com/", encode-for-uri("~bébé"))http://www.example.com/
~b%C3%A9b%C3%A9
concat("http://www.example.com/", encode-for-uri("100% organic"))http://www.example.com/
100%25%20organic

+ W3C Documentation reference +
+ + fn:iri-to-uri() +
+ This function converts an xs:string containing an IRI into a URI according to the rules + spelled out in Section 3.1 of [RFC 3987]. It is idempotent but not invertible.
+ + If $iri 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.
+ + If $iri is the empty sequence, returns the zero-length string.
+ + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$iri
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
iri-to-uri ("http://www.example.com/00/Weather/CA/Los%20Angeles#ocean")"http://www.example.com/00/
Weather/CA/Los%20Angeles#ocean"
iri-to-uri ("http://www.example.com/~bébé")http://www.example.com/
~b%C3%A9b%C3%A9

+ W3C Documentation reference +
+ + fn:escape-html-uri() +
+ This function escapes all characters except printable characters of the US-ASCII coded + character set, specifically the octets ranging from 32 to 126 (decimal). The effect of + the function is to escape a URI in the manner html user agents handle attribute values + that expect URIs. Each character in $uri 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.
+ If $uri is the empty sequence, returns the zero-length string. + +

Note:

+ 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.

+ + + Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?$uri
+ Return type: xs:string

+ Examples:
+ + + + + + + + + +
ExpressionResult
escape-html-uri("http://www.example.com/00/Weather/CA/Los Angeles#ocean") + http://www.example.com/00/Weather/CA/Los Angeles#ocean

+ W3C Documentation reference +
+ + fn:contains() +
+ Returns an xs:boolean indicating whether or not the value of $arg1 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 $arg2, according to the + collation that is used. + + If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable + collation units, it is interpreted as the zero-length string.
+ + If the value of $arg2 is the zero-length string, then the function returns true.
+ + If the value of $arg1 is the zero-length string, the function returns false.
+ + The collation used by the invocation of this function is determined according to the + rules in 7.3.1 Collations. If the specified collation does not support collation units + an error ·may· be raised [err:FOCH0004].

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg1
xs:string?$arg2
xs:string?$collation (Optional)
+ Return type: xs:boolean

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
contains( "tattoo", "tat")true
contains( "tattoo", "ttt")false
contains ( "", ())true

+ W3C Documentation reference +
+ + fn:starts-with() +
+ Returns an xs:boolean indicating whether or not the value of $arg1 starts with a + sequence of collation units that provides a match to the collation units of $arg2 + according to the collation that is used. + + If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable + collation units, it is interpreted as the zero-length string.
+ + If the value of $arg2 is the zero-length string, then the function returns true. If the + value of $arg1 is the zero-length string and the value of $arg2 is not the zero-length + string, then the function returns false.
+ + The collation used by the invocation of this function is determined according to the + rules in 7.3.1 Collations. If the specified collation does not support collation units + an error ·may· be raised [err:FOCH0004].

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg1
xs:string?$arg2
xs:string?$collation (Optional)
+ Return type: xs:boolean

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
starts-with( "tattoo", "tat")true
starts-with( "tattoo", "ttt")false
starts-with ( "", ())true

+ W3C Documentation reference +
+ + fn:ends-with() +
+ Returns an xs:boolean indicating whether or not the value of $arg1 starts with a + sequence of collation units that provides a match to the collation units of $arg2 + according to the collation that is used.
+ + If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable + collation units, it is interpreted as the zero-length string.
+ + If the value of $arg2 is the zero-length string, then the function returns true. If the + value of $arg1 is the zero-length string and the value of $arg2 is not the zero-length + string, then the function returns false.
+ + The collation used by the invocation of this function is determined according to the + rules in 7.3.1 Collations. If the specified collation does not support collation units + an error ·may· be raised [err:FOCH0004].

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg1
xs:string?$arg2
xs:string?$collation (Optional)
+ Return type: xs:boolean

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
ends-with( "tattoo", "too")true
ends-with( "tattoo", "tatoo")false
ends-with ((), ())true

+ W3C Documentation reference +
+ + fn:substring-before() +
+ Returns the substring of the value of $arg1 that precedes in the value of $arg1 the + first occurrence of a sequence of collation units that provides a minimal match to the + collation units of $arg2 according to the collation that is used.
+ + If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable + collation units, it is interpreted as the zero-length string.
+ + If the value of $arg2 is the zero-length string, then the function returns the + zero-length string.
+ + If the value of $arg1 does not contain a string that is equal to the value of $arg2, + then the function returns the zero-length string.
+ + The collation used by the invocation of this function is determined according to the + rules in 7.3.1 Collations If the specified collation does not support collation units an + error ·may· be raised [err:FOCH0004].

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg1
xs:string?$arg2
xs:string?$collation (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
substring-before( "tattoo", "too")tat
substring-before( "tattoo", "tat")<empty string>

+ W3C Documentation reference +
+ + fn:substring-after() +
+ Returns the substring of the value of $arg1 that follows in the value of $arg1 the first + occurrence of a sequence of collation units that provides a minimal match to the + collation units of $arg2 according to the collation that is used.
+ + If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable + collation units, it is interpreted as the zero-length string.
+ + If the value of $arg2 is the zero-length string, then the function returns the value of + $arg1.
+ + If the value of $arg1 does not contain a string that is equal to the value of $arg2, + then the function returns the zero-length string.
+ + The collation used by the invocation of this function is determined according to the + rules in 7.3.1 Collations If the specified collation does not support collation units an + error ·may· be raised [err:FOCH0004].

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$arg1
xs:string?$arg2
xs:string?$collation (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
substring-after( "tattoo", "too")<empty string>
substring-after( "tattoo", "tat")too

+ W3C Documentation reference +
+ + + fn:matches() +
+ The function returns true if $input matches the regular expression supplied as $pattern + as influenced by the value of $flags, if present; otherwise, it returns false.
+ + The effect of calling the first version of this function (omitting the argument $flags) + is the same as the effect of calling the second version with the $flags argument set to + a zero-length string. Flags are defined in 7.6.1.1 Flags.
+ + If $input is the empty sequence, it is interpreted as the zero-length string.
+ Unless the metacharacters ^ and $ 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 + multiline mode).
+ + An error is raised [err:FORX0002] if the value of $pattern is invalid according to the + rules described in section 7.6.1 Regular Expression Syntax.
+ + An error is raised [err:FORX0001] if the value of $flags is invalid according to the + rules described in section 7.6.1 Regular Expression Syntax.

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$input
xs:string$pattern
xs:string$flags (Optional)
+ Return type: xs:boolean

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
matches("abracadabra", "bra")true
matches("abracadabra", "^a.*a$")false

+ W3C Documentation reference +
+ + fn:replace() +
+ The function returns the xs:string that is obtained by replacing each non-overlapping + substring of $input that matches the given $pattern with an occurrence of the + $replacement string.
+ + The effect of calling the first version of this function (omitting the argument $flags) + is the same as the effect of calling the second version with the $flags argument set to + a zero-length string. Flags are defined in 7.6.1.1 Flags.
+ + The $flags argument is interpreted in the same manner as for the fn:matches() + function.
+ + If $input is the empty sequence, it is interpreted as the zero-length string.
+ + If two overlapping substrings of $input both match the $pattern, then only the
first + one (that is, the one whose first character comes first in the $input string) is + replaced. + + Within the $replacement string, a variable $N 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 $input that matched the pattern. $0 refers to the substring captured + by the regular expression as a whole.

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$input
xs:string$pattern
xs:string$replacement
xs:string$flags (Optional)
+ Return type: xs:string

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
replace("abracadabra", "bra", "*")a*cada*
replace("abracadabra", "a.*a", "*")*
replace("AAAA", "A+", "b")b

+ W3C Documentation reference +
+ + fn:tokenize() +
+ This function breaks the $input string into a sequence of strings, treating any + substring that matches $pattern as a separator. The separators themselves are not + returned.
+ + The effect of calling the first version of this function (omitting the argument $flags) + is the same as the effect of calling the second version with the $flags argument set to + a zero-length string. Flags are defined in 7.6.1.1 Flags.
+ + The $flags argument is interpreted in the same way as for the fn:matches() function.
+ + If $input is the empty sequence, or if $input is the zero-length string, the result is + the empty sequence.
+ + If the supplied $pattern matches a zero-length string, that is, if fn:matches("", + $pattern, $flags) returns true, then an error is raised: [err:FORX0003].
+ + If a separator occurs at the start of the $input string, the result sequence will start + with a zero-length string. Zero-length strings will also occur in the result sequence if + a separator occurs at the end of the $input string, or if two adjacent substrings match + the supplied $pattern.

+ + + Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?$input
xs:string$pattern
xs:string$flags (Optional)
+ Return type: xs:string*

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
tokenize("The cat sat on the mat", "\s+")("The", "cat", "sat", "on", "the", "mat")
tokenize("1, 15, 24, 50", ",\s*")("1", "15", "24", "50")
tokenize("1,15,,24,50,", ",")("1", "15", "", "24", "50", "")

+ W3C Documentation reference +
+ +
+
+
+ + + +
+ + fn:number() +
+ Returns the value indicated by $arg or, if $arg is not specified, the context item after + atomization, converted to an xs:double
+ + Calling the zero-argument version of the function is defined to give the same result as + calling the single-argument version with the context item (.). That is, fn:number() is + equivalent to fn:number(.).
+ + If $arg is the empty sequence or if $arg or the context item cannot be converted to an + xs:double, the xs:double value NaN is returned. If the context item is undefined an + error is raised: [err:XPDY0002]XP.
+ + If $arg is the empty sequence, NaN is returned. Otherwise, $arg, or the context item + after atomization, is converted to an xs:double following the rules of 17.1.3.2 Casting + to xs:double. If the conversion to xs:double fails, the xs:double value NaN is + returned.
+ +
+ Arguments: + + + + + + + + + +
TypeDescription
xs:anyAtomicType?Value to convert to number
+ Return type: xs:double

+ W3C Documentation reference +
+ + fn:abs() +
+ Returns the absolute value of $arg. If $arg is negative returns -$arg otherwise returns + $arg. If type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal + or xs:integer the type of the result is the same as the type of $arg. If the type of + $arg is a type derived from one of the numeric types, the result is an instance of the + base numeric type.
+ + For xs:float and xs:double 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.
+ + For detailed type semantics, see Section 7.2.3 The fn:abs, fn:ceiling, fn:floor, + fn:round, and fn:round-half-to-even functions.
+
+ Arguments: + + + + + + + + + +
TypeDescription
numeric?$arg
+ Return type: numeric?

+ + Examples: + + + + + + + + + + + + + +
QueryResult
abs(-2)2
abs(2137)2137

+ W3C Documentation reference +
+ + fn:ceiling() +
+ Returns the smallest (closest to negative infinity) number with no fractional part that + is not less than the value of $arg. If type of $arg is one of the four numeric types + xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the + type of $arg. If the type of $arg is a type derived from one of the numeric types, the + result is an instance of the base numeric type.
+ + For xs:float and xs:double 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.
+
+ Arguments: + + + + + + + + + +
TypeDescription
numeric?$arg
+ Return type: numeric?

+ + Examples: + + + + + + + + + + + + + + + + + +
QueryResult
ceiling(10.5)11
ceiling(-10.5)-10
ceiling(10.1)11

+ W3C Documentation reference +
+ + fn:floor() +
+ Returns the largest (closest to positive infinity) number with no fractional part that + is not greater than the value of $arg. If type of $arg is one of the four numeric types + xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the + type of $arg. If the type of $arg is a type derived from one of the numeric types, the + result is an instance of the base numeric type.
+ + For float and double arguments, if the argument is positive zero, then positive zero is + returned. If the argument is negative zero, then negative zero is returned.
+
+ Arguments: + + + + + + + + + +
TypeDescription
numeric?$arg
+ Return type: numeric?

+ + Examples: + + + + + + + + + + + + + + + + + +
QueryResult
floor(10.5)10
floor(-10.5)-11
floor(10.8)10

+ W3C Documentation reference +
+ + fn:round() +
+ Returns the number with no fractional part that is closest to the argument. If there are + two such numbers, then the one that is closest to positive infinity is returned. If type + of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer + the type of the result is the same as the type of $arg. If the type of $arg is a type + derived from one of the numeric types, the result is an instance of the base numeric + type.
+ + For xs:float and xs:double arguments, if the argument is positive infinity, then + positive infinity is returned. If the argument is negative infinity, then negative + infinity is returned. 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, but greater than or equal to -0.5, then negative zero is returned. In + the cases where positive zero or negative zero is returned, negative zero or positive + zero may be returned as [XML Schema Part 2: Datatypes Second Edition] does not + distinguish between the values positive zero and negative zero.
+ + For the last two cases, note that the result is not the same as fn:floor(x+0.5).
+
+ Arguments: + + + + + + + + + +
TypeDescription
numeric?$arg
+ Return type: numeric?

+ + Examples: + + + + + + + + + + + + + + + + + +
QueryResult
round(10.5)11
round(10.4999)10
round(-10.5)-10

+ W3C Documentation reference +
+ + fn:round-half-to-even() +
+ The value returned is the nearest (that is, numerically closest) value to $arg that is a + multiple of ten to the power of minus $precision. If two such values are equally near + (e.g. if the fractional part in $arg is exactly .500...), the function returns the one + whose least significant digit is even.
+ + If the type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or + xs:integer the type of the result is the same as the type of $arg. If the type of $arg + is a type derived from one of the numeric types, the result is an instance of the base + numeric type.
+ + The first signature of this function produces the same result as the second signature + with $precision=0.
+ + For arguments of type xs:float and xs:double, if the argument is NaN, positive or + negative zero, or positive or negative infinity, then the result is the same as the + argument. In all other cases, the argument is cast to xs:decimal, the function is + applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float + or xs:double as appropriate to form the function result. If the resulting xs:decimal + value is zero, then positive or negative zero is returned according to the sign of the + original argument.
+ + Note that the process of casting to xs:decimal may result in an error + [err:FOCA0001].
+ + If $arg is of type xs:float or xs:double, rounding occurs on the value of the mantissa + computed with exponent = 0.
+
+ Arguments: + + + + + + + + + + + + + +
TypeDescription
numeric?$arg
numeric?$precision (Optional)
+ Return type: numeric?

+ + Examples: + + + + + + + + + + + + + + + + + + + + + +
QueryResult
round-half-to-even(0.5)0
round-half-to-even(1.5)2
round-half-to-even(2.5)2
round-half-to-even(2.6)3

+ W3C Documentation reference +
+ +
+
+
+ + + +
+ + fn:data() +
+ fn:data takes a sequence of items and returns a sequence of atomic values.
+ + The result of fn:data is the sequence of atomic values produced by applying the + following rules to each item in $arg:
+
    +
  • If the item is an atomic value, it is returned.
  • +
  • + If the item is a node: +
      +
    • If the node does not have a typed value an error is raised + [err:FOTY0012].
    • +
    • Otherwise, fn:data() returns the typed value of the node as defined by + the accessor function dm:typed-value in Section 5.15 typed-value + AccessorDM.
    • +
    +
  • +
+
+ Arguments: + + + + + + + + + +
TypeDescription
item*Items to convert.
+ Return type: xs:anyAtomicType*

+ Examples: + + + + + + + + + +
QueryResult
data(/l:library/l:readerList/p:person[1])7321
Adam
Choke

+ + W3C Documentation reference +
+ + fn:index-of() +
+ Returns the root of the tree to which $arg belongs. This will usually, but not + necessarily, be a document node.
+ + If $arg is the empty sequence, the empty sequence is returned.
+ + If $arg is a document node, $arg is returned.
+ + If the function is called without an argument, the context item (.) 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 following errors may be raised: if the context item is undefined [err:XPDY0002]; if + the context item is not a node [err:XPTY0004].

+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType$seqParam
xs:anyAtomicType$srchParam
xs:string$collation (Optional)
+ Return type: xs:integer*

+ Examples: + + + + + + + + + + + + + + + + + +
QueryResult
index-of((10, 20, 30, 40), 35)()
index-of((10, 20, 30, 30, 20, 10), 20)(2, 5)
index-of(("a", "sport", "and", "a", "pastime"), "a")(1, 4)

+ + W3C Documentation reference +
+ + + fn:empty() +
+ If the value of $arg is the empty sequence, the function returns true; otherwise, the + function returns false.

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: xs:boolean

+ Examples: + + + + + + + + + +
QueryResult
empty(fn:remove(("hello", "world"), 1))false

+ + W3C Documentation reference +
+ + + fn:exists() +
+ If the value of $arg is not the empty sequence, the function returns true; otherwise, + the function returns false.

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: xs:boolean

+ Examples: + + + + + + + + + +
QueryResult
exists(fn:remove(("hello"), 1))true

+ + W3C Documentation reference +
+ + + fn:distinct-values() +
+ Returns the sequence that results from removing from $arg all but one of a set of values + that are eq to one other. Values of type xs:untypedAtomic are compared as if they were + of type xs:string. Values that cannot be compared, i.e. the eq operator is not defined + for their types, are considered to be distinct. The order in which the sequence of + values is returned is ·implementation dependent·.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*$arg
xs:string$collation (Optional)
+ Return type: xs:anyAtomicType*

+ Examples: + + + + + + + + + +
QueryResult
distinct-values((1, 2.0, 3, 2))(1, 3, 2.0)

+ + W3C Documentation reference +
+ + fn:insert-before() +
+ Returns a new sequence constructed from the value of $target with the value of $inserts + inserted at the position specified by the value of $position. (The value of $target is + not affected by the sequence construction.)
+ + If $target is the empty sequence, $inserts is returned. If $inserts is the empty + sequence, $target is returned.
+ + The value returned by the function consists of all items of $target whose index is less + than $position, followed by all items of $inserts, followed by the remaining elements of + $target, in that sequence.
+ + If $position is less than one (1), the first position, the effective value of $position + is one (1). If $position is greater than the number of items in $target, then the + effective value of $position is equal to the number of items in $target plus 1.

+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*$target
xs:integer$position
item()*$inserts
+ Return type: item()*

+ Examples:
+ let $x := ("a", "b", "c") + + + + + + + + + + + + + + + + + +
QueryResult
insert-before($x, 0, "z")("z", "a", "b", "c")
insert-before($x, 1, "z")("z", "a", "b", "c")
insert-before($x, 2, "z")("a", "z", "b", "c")

+ + W3C Documentation reference +
+ + fn:remove() +
+ Returns a new sequence constructed from the value of $target with the item at the + position specified by the value of $position removed.
+ + If $position is less than 1 or greater than the number of items in $target, $target is + returned. Otherwise, the value returned by the function consists of all items of $target + whose index is less than $position, followed by all items of $target whose index is + greater than $position. If $target is the empty sequence, the empty sequence is + returned.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
item()*$target
xs:integer$position
+ Return type: item()*

+ Examples:
+ let $x := ("a", "b", "c") + + + + + + + + + + + + + + + + + +
QueryResult
remove($x, 0) ("a", "b", "c")
remove($x, 1)("b", "c")
remove($x, 6)("a", "b", "c")

+ + W3C Documentation reference +
+ + + fn:reverse() +
+ Reverses the order of items in a sequence. If $arg is the empty sequence, the empty + sequence is returned.

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: item()*

+ Examples:
+ let $x := ("a", "b", "c") + + + + + + + + + + + + + + + + + +
QueryResult
reverse($x)("c", "b", "a")
reverse(("hello")) ("hello")
reverse(())()

+ + W3C Documentation reference +
+ + + fn:subsequence() +
+ Returns the contiguous sequence of items in the value of $sourceSeq beginning at the + position indicated by the value of $startingLoc and continuing for the number of items + indicated by the value of $length. + If $sourceSeq is the empty sequence, the empty sequence is returned.
+ + If $startingLoc is zero or negative, the subsequence includes items from the beginning + of the $sourceSeq.
+ + If $length is not specified, the subsequence includes items to the end of + $sourceSeq.
+ + If $length is greater than the number of items in the value of $sourceSeq following + $startingLoc, the subsequence includes items to the end of $sourceSeq.
+ + The first item of a sequence is located at position 1, not position 0.

+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*$sourceSeq
xs:double$startingLoc (Optional)
xs:double$length (Optional)
+ Return type: item()*

+ Examples:
+ let $seq = ($item1, $item2, $item3, $item4, ...) + + + + + + + + + + + + + +
QueryResult
subsequence($seq, 4)($item4, ...)
subsequence($seq, 3, 2)($item3, $item4)

+ + W3C Documentation reference +
+ + + fn:unordered() +
+ Returns the items of $sourceSeq in an implementation dependent order.

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$sourceSeq
+ Return type: item()*

+ + W3C Documentation reference +
+ + fn:zero-or-one() +
+ Returns $arg if it contains zero or one items. Otherwise, raises an error + [err:FORG0003].

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: item()?

+ Examples: + + + + + + + + + + + + + +
QueryResult
zero-or-one(("a"))a
zero-or-one(("a", "b"))A sequence of more than one item is not allowed as the first argument of + fn:zero-or-one() ("a", "b")

+ + W3C Documentation reference +
+ + + fn:one-or-more() +
+ Returns $arg if it contains one or more items. Otherwise, raises an error + [err:FORG0004].

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: item()?

+ Examples: + + + + + + + + + + + + + +
QueryResult
one-or-more(("a"))a
one-or-more(("a", "b"))a
b

+ + W3C Documentation reference +
+ + + fn:exactly-one() +
+ Returns $arg if it contains exactly one item. Otherwise, raises an error + [err:FORG0005].

+ + Arguments: + + + + + + + + + +
TypeDescription
item()*$arg
+ Return type: item()?

+ Examples: + + + + + + + + + + + + + +
QueryResult
exactly-one(("a"))a
exactly-one(("a", "b"))A sequence of more than one item is not allowed as the first argument of + fn:exactly-one() ("a", "b")

+ + W3C Documentation reference +
+ + + fn:deep-equal() +
+ This 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. This is defined in more + detail below. The $collation 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 7.3.1 Collations.
+ + If the two sequences are both empty, the function returns true.
+ + If the two sequences are of different lengths, the function returns false.
+ + If the two sequences are of the same length, the function returns true if and only if + every item in the sequence $parameter1 is deep-equal to the item at the same position in + the sequence $parameter2. The rules for deciding whether two items are deep-equal + follow. + + For more in-depth description look into W3C Documentation

+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*$parameter1
item()*$parameter2
xs:string$collation (Optional)
+ Return type: xs:boolean

+ Examples: + + + + + + + + + + + + + +
QueryResult
deep-equal(/l:library/p:person[0], /l:library/p:person[1])true
deep-equal(/l:library/p:person[0], /l:library)false

+ + W3C Documentation reference +
+ + + fn:id() +
+ Returns the sequence of element nodes that have an ID value matching the value of one or + more of the IDREF values supplied in $arg. + +

Note:

+ + This function does not have the desired effect when searching a document in which + elements of type xs:ID are used as identifiers. To preserve backwards compatibility, a + new function fn:element-with-id is therefore being introduced; it behaves the same way + as fn:id in the case of ID-valued attributes. +

+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string*$arg
node()*$node
xs:string$collation (Optional)
+ Return type: element()*

+ + W3C Documentation reference +
+ + fn:idref() +
+ Returns the sequence of element or attribute nodes with an IDREF value matching the + value of one or more of the ID values supplied in $arg.

+ + Arguments: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string*$arg
node()*$node
xs:string$collation (Optional)
+ Return type: node()*

+ + W3C Documentation reference +
+ + + fn:doc() +
+ Returns the sequence of element or attribute nodes with an IDREF value matching the + value of one or more of the ID values supplied in $arg.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:string$uri
+ Return type: document-node()?

+ Examples: + + + + + + + + + +
QueryResult
doc("test.xml")Contents of test.xml file returned as node

+ + W3C Documentation reference +
+ + + fn:doc-available() +
+ Retrieves a document using a URI supplied as an xs:string, and returns the corresponding + document node.
+ + If $uri is the empty sequence, the result is an empty sequence.
+ + If $uri is not a valid URI, an error may be raised [err:FODC0005].
+ + If $uri is a relative URI reference, it is resolved relative to the value of the base + URI property from the static context. The resulting absolute URI is promoted to an + xs:string.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:string$uri
+ Return type: xs:boolean

+ Examples: + + + + + + + + + +
QueryResult
doc("test.xml")true (If document is available)

+ + W3C Documentation reference +
+ + + fn:collection() +
+ This function takes an xs:string as argument and returns a sequence of nodes obtained by + interpreting $arg as an xs:anyURI and resolving it according to the mapping specified in + Available collections described in Section C.2 Dynamic Context ComponentsXP. If + Available collections provides a mapping from this string to a sequence of nodes, the + function returns that sequence. If Available collections maps the string to an empty + sequence, then the function returns an empty sequence. If Available collections provides + no mapping for the string, an error is raised [err:FODC0004].
+ If $arg is not specified, the function returns the sequence of the nodes in the default + collection in the dynamic context. See Section C.2 Dynamic Context ComponentsXP. If the + value of the default collection is undefined an error is raised [err:FODC0002].

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:string?$arg (Optional)
+ Return type: node()*

+ Examples: + + + + + + + + + +
QueryResult
collection("")<empty sequence>

+ + W3C Documentation reference +
+ + fn:element-with-id() +
+ Returns the sequence of element nodes that have an ID value matching the value of one or + more of the IDREF values supplied in $arg.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:string?$arg (Optional)
+ Return type: node()*

+ + W3C Documentation reference +
+ + fn:position() +
+ Returns the context position from the dynamic context. (See Section C.2 Dynamic Context + ComponentsXP.) If the context item is undefined, an error is raised: + [err:XPDY0002]XP.

+ + Return type: xs:integer

+ Examples: + + + + + + + + + +
QueryResult
/l:library/l:readerList/position()1

+ + W3C Documentation reference +
+ + + fn:last() +
+ Returns the context size from the dynamic context. (See Section C.2 Dynamic Context + ComponentsXP.) If the context item is undefined, an error is raised: + [err:XPDY0002]XP.

+ + Return type: xs:integer

+ Examples: + + + + + + + + + +
QueryResult
/l:library/l:readerList/p:person/last()2
2

+ + W3C Documentation reference +
+ +
+
+
+ + + +
+ + fn:years-from-duration() +
+ Returns an xs:integer representing the years component in the value of $arg. The result + is obtained by casting $arg to an xs:yearMonthDuration (see 17.1.4 Casting to duration + types) and then computing the years component as described in 10.3.1.3 Canonical + representation.
+ + The result may be negative.
+ + If $arg is an xs:dayTimeDuration returns 0.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
years-from-duration(xs:yearMonthDuration("P20Y15M"))21
years-from-duration(xs:yearMonthDuration("-P15M"))-1
years-from-duration(xs:dayTimeDuration("-P2DT15H"))0

+ W3C Documentation reference +
+ + fn:months-from-duration() +
+ Returns an xs:integer representing the months component in the value of $arg. The result + is obtained by casting $arg to an xs:yearMonthDuration (see 17.1.4 Casting to duration + types) and then computing the months component as described in 10.3.1.3 Canonical + representation.
+ + The result may be negative.
+ + If $arg is an xs:dayTimeDuration returns 0.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
months-from-duration(xs:yearMonthDuration("P20Y15M"))3
months-from-duration(xs:yearMonthDuration("-P20Y18M"))-6
months-from-duration(xs:dayTimeDuration("-P2DT15H0M0S"))0

+ W3C Documentation reference +
+ + fn:days-from-duration() +
+ Returns an xs:integer representing the days component in the value of $arg. The result + is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration + types) and then computing the days component as described in 10.3.2.3 Canonical + representation.
+ + The result may be negative.
+ + If $arg is an xs:yearMonthDuration returns 0.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
days-from-duration(xs:dayTimeDuration("P3DT10H"))3
days-from-duration(xs:dayTimeDuration("P3DT55H"))5
days-from-duration(xs:yearMonthDuration("P3Y5M"))0

+ W3C Documentation reference +
+ + fn:hours-from-duration() +
+ Returns an xs:integer representing the hours component in the value of $arg. The result + is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration + types) and then computing the hours component as described in 10.3.2.3 Canonical + representation.
+ + The result may be negative.
+ + If $arg is an xs:yearMonthDuration returns 0.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
hours-from-duration(xs:dayTimeDuration("P3DT10H"))10
hours-from-duration(xs:dayTimeDuration("P3DT12H32M12S"))12
hours-from-duration(xs:dayTimeDuration("PT123H"))0

+ W3C Documentation reference +
+ + + fn:minutes-from-duration() +
+ Returns an xs:integer representing the minutes component in the value of $arg. The + result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to + duration types) and then computing the minutes component as described in 10.3.2.3 + Canonical representation. + + The result may be negative. + + If $arg is an xs:yearMonthDuration returns 0. + + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
minutes-from-duration(xs:dayTimeDuration("P3DT10H"))0
minutes-from-duration(xs:dayTimeDuration("-P5DT12H30M"))-30

+ W3C Documentation reference +
+ + + fn:seconds-from-duration() +
+ Returns an xs:decimal representing the seconds component in the value of $arg. The + result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to + duration types) and then computing the seconds component as described in 10.3.2.3 + Canonical representation.
+ + The result may be negative.
+ + If $arg is an xs:yearMonthDuration returns 0.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?$arg
+ Return type: xs:decimal?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
seconds-from-duration(xs:dayTimeDuration("P3DT10H12.5S"))12.5
seconds-from-duration(xs:dayTimeDuration("-PT256S"))-16.0

+ W3C Documentation reference +
+ + + fn:year-from-dateTime() +
+ Returns an xs:integer representing the year component in the localized value of $arg. + The result may be negative.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
year-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))1999
year-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))1999
year-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))2000

+ W3C Documentation reference +
+ + + fn:month-from-dateTime() +
+ Returns an xs:integer between 1 and 12, both inclusive, representing the month component + in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
month-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))5
month-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))12
month-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))1

+ W3C Documentation reference +
+ + fn:day-from-dateTime() +
+ Returns an xs:integer between 1 and 31, both inclusive, representing the day component + in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
day-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))31
day-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))31
day-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))1

+ W3C Documentation reference +
+ + + fn:hours-from-dateTime() +
+ Returns an xs:integer between 0 and 23, both inclusive, representing the hours component + in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
hours-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))13
hours-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))19
hours-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))0

+ W3C Documentation reference +
+ + + fn:minutes-from-dateTime() +
+ Returns an xs:integer value between 0 and 59, both inclusive, representing the minute + component in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
minutes-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))20
minutes-from-dateTime(xs:dateTime("1999-05-31T13:30:00+05:30"))30

+ W3C Documentation reference +
+ + fn:seconds-from-dateTime() +
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing + the seconds and fractional seconds in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:decimal?

+ Examples:
+ + + + + + + + + +
ExpressionResult
seconds-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))0

+ W3C Documentation reference +
+ + fn:timezone-from-dateTime() +
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing + the seconds and fractional seconds in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?$arg
+ Return type: xs:dayTimeDuration?

+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
timezone-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))-PT5H
timezone-from-dateTime(xs:dateTime("2000-06-12T13:20:00Z")) PT0S
timezone-from-dateTime(xs:dateTime("2004-08-27T00:00:00"))()

+ W3C Documentation reference +
+ + + fn:year-from-date() +
+ Returns an xs:integer representing the year in the localized value of $arg. The value + may be negative.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
year-from-date(xs:date("1999-05-31"))1999
year-from-date(xs:date("2000-01-01+05:00"))2000

+ W3C Documentation reference +
+ + fn:month-from-date() +
+ Returns an xs:integer between 1 and 12, both inclusive, representing the month component + in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
month-from-date(xs:date("1999-05-31-05:00"))5
month-from-date(xs:date("2000-01-01+05:00"))1

+ W3C Documentation reference +
+ + fn:day-from-date() +
+ Returns an xs:integer between 1 and 31, both inclusive, representing the day component + in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
day-from-date(xs:date("1999-05-31-05:00"))31
day-from-date(xs:date("2000-01-01+05:00"))1

+ W3C Documentation reference +
+ + + fn:timezone-from-date() +
+ Returns the timezone component of $arg if any. If $arg has a timezone component, then + the result is an xs:dayTimeDuration that indicates deviation from UTC; its value may + range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty + sequence.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?$arg
+ Return type: xs:dayTimeDuration?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
timezone-from-date(xs:date("1999-05-31-05:00"))-PT5H
timezone-from-date(xs:date("2000-06-12Z"))PT0S

+ W3C Documentation reference +
+ + + fn:hours-from-time() +
+ Returns an xs:integer between 0 and 23, both inclusive, representing the value of the + hours component in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
hours-from-time(xs:time("11:23:00"))11
hours-from-time(xs:time("24:00:00"))0

+ W3C Documentation reference +
+ + + fn:minutes-from-time() +
+ Returns an xs:integer between 0 and 23, both inclusive, representing the value of the + hours component in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?$arg
+ Return type: xs:integer?

+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
hours-from-time(xs:time("11:23:00"))11
hours-from-time(xs:time("24:00:00"))0

+ W3C Documentation reference +
+ + fn:seconds-from-time() +
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing + the seconds and fractional seconds in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?$arg
+ Return type: xs:decimal?

+ Examples:
+ + + + + + + + + + +
ExpressionResult
seconds-from-time(xs:time("13:20:10.5"))10.5

+ W3C Documentation reference +
+ + + fn:timezone-from-time() +
+ Returns an xs:decimal value greater than or equal to zero and less than 60, representing + the seconds and fractional seconds in the localized value of $arg.
+ + If $arg is the empty sequence, returns the empty sequence.

+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?$arg
+ Return type: xs:dayTimeDuration?

+ Examples:
+ + + + + + + + + + + + + + +
ExpressionResult
timezone-from-time(xs:time("13:20:00-05:00"))-PT5H
timezone-from-time(xs:time("13:20:00"))()

+ W3C Documentation reference +
+ + + fn:adjust-date-to-timezone() +
+ Adjusts an xs:date value to a specific timezone, or to no timezone at all. If $timezone + is the empty sequence, returns an xs:date without a timezone. Otherwise, returns an + xs:date with a timezone. For purposes of timezone adjustment, an xs:date is treated as + an xs:dateTime with time 00:00:00.
+ + If $timezone is not specified, then $timezone is the value of the implicit timezone in + the dynamic context.
+ + If $arg is the empty sequence, then the result is the empty sequence.
+ + A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or greater + than PT14H or if does not contain an integral number of minutes.
+ + If $arg does not have a timezone component and $timezone is the empty sequence, then the + result is the value of $arg.
+ + If $arg does not have a timezone component and $timezone is not the empty sequence, then + the result is $arg with $timezone as the timezone component.
+ + If $arg has a timezone component and $timezone is the empty sequence, then the result is + the localized value of $arg without its timezone component.
+ + If $arg has a timezone component and $timezone is not the empty sequence, then: +
    +
  • Let $srcdt be an xs:dateTime value, with 00:00:00 for the time component and + date and timezone components that are the same as the date and timezone + components of $arg.
  • +
  • Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt, + $timezone)
  • +
  • The result of this function will be a date value that has date and timezone + components that are the same as the date and timezone components of $r.
  • +
+

+ + Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:date?$arg
xs:dayTimeDuration?$timezone
+ Return type: xs:date?

+ Examples:
+ + + + + + + + + + + + + + +
ExpressionResult
adjust-date-to-timezone(xs:date("2002-03-07"))2002-03-07-05:00
adjust-date-to-timezone(xs:date("2002-03-07"), xs:dayTimeDuration("-PT10H")) + 2002-03-07-10:00

+ W3C Documentation reference +
+ + fn:adjust-time-to-timezone() +
+ Adjusts an xs:time value to a specific timezone, or to no timezone at all. If $timezone + is the empty sequence, returns an xs:time without a timezone. Otherwise, returns an + xs:time with a timezone.
+ + If $timezone is not specified, then $timezone is the value of the implicit timezone in + the dynamic context.
+ + If $arg is the empty sequence, then the result is the empty sequence.
+ + A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or greater + than PT14H or if does not contain an integral number of minutes.
+ + If $arg does not have a timezone component and $timezone is the empty sequence, then the + result is $arg.
+ + If $arg does not have a timezone component and $timezone is not the empty sequence, then + the result is $arg with $timezone as the timezone component.
+ + If $arg has a timezone component and $timezone is the empty sequence, then the result is + the localized value of $arg without its timezone component.
+ + If $arg has a timezone component and $timezone is not the empty sequence, then: +
    +
  • Let $srcdt be an xs:dateTime value, with an arbitrary date for the date + component and time and timezone components that are the same as the time and + timezone components of $arg.
  • +
  • Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt, + $timezone)
  • +
  • The result of this function will be a time value that has time and timezone + components that are the same as the time and timezone components of $r.
  • +
+

+ + Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:time?$arg
xs:dayTimeDuration?$timezone
+ Return type: xs:time?

+ Examples:
+ + + + + + + + + + + + + + +
ExpressionResult
adjust-time-to-timezone(xs:time("10:00:00"))10:00:00-05:00
adjust-time-to-timezone(xs:time("10:00:00"), xs:dayTimeDuration("-PT10H")) + 10:00:00-10:00

+ W3C Documentation reference +
+ + fn:current-dateTime() +
+ Returns the current dateTime (with timezone) from the dynamic context. (See Section C.2 + Dynamic Context ComponentsXP.) This is an xs:dateTime that is current at some time + during the evaluation of a query or transformation in which fn:current-dateTime() is + executed. This function is ·stable·. The precise instant during the query or + transformation represented by the value of fn:current-dateTime() is ·implementation + dependent·.

+ + Return type: xs:dateTime

+ Examples:
+ + + + + + + + + + +
ExpressionResult
current-dateTime()xs:dateTime corresponding to the current date and time

+ W3C Documentation reference +
+ + fn:current-date() +
+ Returns xs:date(fn:current-dateTime()). This is an xs:date (with timezone) that is + current at some time during the evaluation of a query or transformation in which + fn:current-date() is executed. This function is ·stable·. The precise instant during the + query or transformation represented by the value of fn:current-date() is ·implementation + dependent·.

+ + Return type: xs:date

+ Examples:
+ + + + + + + + + + +
ExpressionResult
current-date()xs:date corresponding to the current date

+ W3C Documentation reference +
+ + + fn:current-time() +
+ Returns xs:date(fn:current-dateTime()). This is an xs:date (with timezone) that is + current at some time during the evaluation of a query or transformation in which + fn:current-date() is executed. This function is ·stable·. The precise instant during the + query or transformation represented by the value of fn:current-date() is ·implementation + dependent·.

+ + Return type: xs:time

+ Examples:
+ + + + + + + + + + +
ExpressionResult
current-time()xs:date corresponding to the current time

+ W3C Documentation reference +
+ + fn:implicit-timezone() +
+ Returns the value of the implicit timezone property from the dynamic context. Components + of the dynamic context are discussed in Section C.2 Dynamic Context + ComponentsXP.

+ + Return type: xs:string

+ Examples:
+ + + + + + + + + + +
ExpressionResult
implicit-timezone()PT0S

+ W3C Documentation reference
- -
-
-
- - - -
- - - [1.0] fn:string(object) +
+ + +
-
+ + fn:error() +
+ The fn:error function is a general function that may be invoked as above but may also be + invoked from [XQuery 1.0: An XML Query Language] or [XML Path Language (XPath) 2.0] + applications with, for example, an xs:QName argument. +
+ W3C Documentation reference +
+ + + fn:trace() +
+ Provides an execution trace intended to be used in debugging queries.
+ + The input $value is returned, unchanged, as the result of the function. In addition, the + inputs $value, converted to an xs:string, and $label 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 invocations of + the fn:trace() function is ·implementation dependent·.
+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
item*$value
xs:string$label
+ Return type: item

+
+ W3C Documentation reference +
+ + +
+
+
+ + + +
+ + fn:resolve-uri() +
+ This function enables a relative URI reference to be resolved against an absolute URI. + + The first form of this function resolves $relative against the value of the base-uri + property from the static context. If the base-uri property is not initialized in the + static context an error is raised [err:FONS0005].
+ + If $relative is a relative URI reference, it is resolved against $base, or against the + base-uri property from the static context, using an algorithm such as those described in + [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned.
+ If $relative is an absolute URI reference, it is returned unchanged.
+ + If $relative is the empty sequence, the empty sequence is returned.
+ + If $relative is not a valid URI according to the rules of the xs:anyURI data type, or if + it is not a suitable relative reference to use as input to the chosen resolution + algorithm, then an error is raised [err:FORG0002].
+ + If $base is not a valid URI according to the rules of the xs:anyURI data type, if it is + not a suitable URI to use as input to the chosen resolution algorithm (for example, if + it is a relative URI reference, if it is a non-hierarchic URI, or if it contains a + fragment identifier), then an error is raised [err:FORG0002].
+ + If the chosen resolution algorithm fails for any other reason then an error is raised + [err:FORG0009].
+ +

Note:

+ + Resolving a URI does not dereference it. This is merely a syntactic operation on two + character strings. +

+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?$relative
xs:string$base
+ Return type: xs:anyURI?

+
+ W3C Documentation reference +
+ + fn:resolve-QName() +
+ Returns an xs:QName value (that is, an expanded-QName) by taking an xs:string that has + the lexical form of an xs:QName (a string in the form "prefix:local-name" or + "local-name") and resolving it using the in-scope namespaces for a given element.
+ + If $qname does not have the correct lexical form for xs:QName an error is raised + [err:FOCA0002].
+ + If $qname is the empty sequence, returns the empty sequence.
+ + More specifically, the function searches the namespace bindings of $element for a + binding whose name matches the prefix of $qname, or the zero-length string if it has no + prefix, and constructs an expanded-QName whose local name is taken from the supplied + $qname, and whose namespace URI is taken from the string value of the namespace + binding.
+ + If the $qname has a prefix and if there is no namespace binding for $element that + matches this prefix, then an error is raised [err:FONS0004].
+ + If the $qname has no prefix, and there is no namespace binding for $element + 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 $qname argument is retained in the + returned expanded-QName, as discussed in Section 2.1 TerminologyDM.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:string?$qname
element$element
+ Return type: xs:QName?

+ Examples: + + + + + + + + + + + + + +
QueryResult
resolve-QName("hello", /l:library/l:libraryName)hello
resolve-QName("l:libraryID", /l:library/l:libraryName)l:libraryID

+ + W3C Documentation reference +
+ + fn:QName() +
+ Returns an xs:QName with the namespace URI given in $paramURI. If $paramURI is the + zero-length string or the empty sequence, it represents "no namespace"; in this case, if + the value of $paramQName contains a colon (:), an error is raised [err:FOCA0002]. The + prefix (or absence of a prefix) in $paramQName is retained in the returned xs:QName + value. The local name in the result is taken from the local part of $paramQName.
+ + If $paramQName does not have the correct lexical form for xs:QName an error is raised + [err:FOCA0002].
+ + Note that unlike xs:QName this function does not require a xs:string literal as the + argument.

+ Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:string?$paramURI
xs:string$paramQName
+ Return type: xs:QName

+ Examples: + + + + + + + + + +
QueryResult
QName("http://www.release11.com/library", "l:libraryName")l:libraryName
+ For more extensive examples see W3C documentation below.
+ + W3C Documentation reference +
+ + fn:prefix-from-QName() +
+ Returns an xs:NCName representing the prefix of $arg. The empty sequence is returned if + $arg is the empty sequence or if the value of $arg contains no prefix.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:QName?$arg
+ Return type: xs:NCName?

+ Examples: + + + + + + + + + +
QueryResult
prefix-from-QName(resolve-QName("l:library", /l:library))l
+ + W3C Documentation reference +
+ + fn:local-name-from-QName() +
+ Returns an xs:NCName representing the local part of $arg. If $arg is the empty sequence, + returns the empty sequence.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:QName?$arg
+ Return type: xs:NCName?

+ Examples: + + + + + + + + + +
QueryResult
prefix-from-QName(resolve-QName("l:library", /l:library))library
+ + W3C Documentation reference +
+ + + fn:prefix-from-QName() +
+ Returns an xs:NCName representing the prefix of $arg. The empty sequence is returned if + $arg is the empty sequence or if the value of $arg contains no prefix.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:QName?$arg
+ Return type: xs:NCName?

+ Examples: + + + + + + + + + +
QueryResult
prefix-from-QName(resolve-QName("l:library", /l:library))l
+ + W3C Documentation reference +
+ + fn:namespace-uri-from-QName() +
+ Returns the namespace URI for $arg as an xs:anyURI. If $arg is the empty sequence, the + empty sequence is returned. If $arg is in no namespace, the zero-length xs:anyURI is + returned.

+ + Arguments: + + + + + + + + + +
TypeDescription
xs:QName?$arg
+ Return type: xs:anyURI?

+ Examples: + + + + + + + + + +
QueryResult
prefix-from-QName(resolve-QName("l:library", /l:library))http://www.release11.com/library
+ + W3C Documentation reference +
+ + + fn:namespace-uri-for-prefix() +
+ Returns the namespace URI of one of the in-scope namespaces for $element, identified by + its namespace prefix.
+ + If $element has an in-scope namespace whose namespace prefix is equal to $prefix, it + returns the namespace URI of that namespace. If $prefix is the zero-length string or the + empty sequence, it returns the namespace URI of the default (unnamed) namespace. + Otherwise, it returns the empty sequence.
+ + Prefixes are equal only if their Unicode code points match exactly.

+ + Arguments: + + + + + + + + + + + + + +
TypeDescription
xs:string?$prefix
element()$element
+ Return type: xs:anyURI?

+ Examples: + + + + + + + + + +
QueryResult
namespace-uri-for-prefix("l", /l:library)http://www.release11.com/library
+ + W3C Documentation reference +
+ + + fn:in-scope-prefixes() +
+ Returns the prefixes of the in-scope namespaces for $element. For namespaces that have a + prefix, it returns the prefix as an xs:NCName. For the default namespace, which has no + prefix, it returns the zero-length string.

+ + Arguments: + + + + + + + + + +
TypeDescription
element()$element
+ Return type: xs:string*

+ Examples: + + + + + + + + + +
QueryResult
in-scope-prefixes(/l:library)b
l
p
xsi
xml
+ + W3C Documentation reference +
+ + fn:static-base-uri() +
+ Returns the value of the Base URI property from the static context. If the Base URI + property is undefined, the empty sequence is returned. Components of the static context + are discussed in Section C.1 Static Context ComponentsXP.

+ + Return type: xs:anyURI?

+ Examples:
+ + + + + + + + + + +
ExpressionResult
static-base-uri()()<empty sequence>

+ W3C Documentation reference +
+ +
+
+ + +
+ + + +
+ + fn:outermost(node()*) +
+ Returns the outermost nodes of the input sequence that are not ancestors of any other + node in the input sequence
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()*Sequence of nodes
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:outermost(//chapter)Sequence of outermost chapter nodes
fn:outermost(/book//*)Sequence of outermost nodes in the book

+ W3C Documentation reference: outermost +
+ + + fn:innermost(node()*) +
+ Returns the innermost nodes of the input sequence that are not descendants of any other + node in the input sequence
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()*Sequence of nodes
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:innermost(//chapter)Sequence of innermost chapter nodes
fn:innermost(/book//*)Sequence of innermost nodes in the book

+ W3C Documentation reference: innermost +
+ + + fn:has-children(node()?) +
+ Returns true if the specified node has one or more children, otherwise returns false
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:has-children(/book/chapter[1])true
fn:has-children(/book/chapter[1]/title)false

+ W3C Documentation reference: has-children +
+ + + fn:path(node()?) +
+ Returns a string that represents the path of the specified node within the XML + document
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:path(/book/chapter[1])/book/chapter[1]
fn:path(/book/chapter[2]/title)/book/chapter[2]/title

+ W3C Documentation reference: path +
+ + + fn:root(node()?) +
+ Returns the root node of the tree that contains the specified node
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:root(/book/chapter)<book> element (root node)
fn:root(/book/chapter[1])<book> element (root node)

+ W3C Documentation reference: root +
+ + + fn:namespace-uri(node()?) +
+ Returns the namespace URI of the specified node
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:namespace-uri(/example:root)"http://www.example.com/ns"
fn:namespace-uri(/a/b)""

+ W3C Documentation reference: namespace-uri +
+ + + fn:local-name(node()?) +
+ Returns the local part of the name of the specified node
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:local-name(/a/b)"b"
fn:local-name(/example:root)"root"

+ W3C Documentation reference: local-name +
+ + fn:name(node()?) +
+ Returns the expanded QName of the specified node as a string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:name(/a/b)"b"
fn:name(/example:root)"example:root"

+ W3C Documentation reference: name +
+ + + + fn:document-uri(node?) +
+ Returns the document URI of the given node or the context item
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node?Returns the document URI of the specified node or the context item (if no + argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:document-uri(/library/fiction:book[1])http://example.com/library.xml (assuming the document URI of the first + fiction:book element is "http://example.com/library.xml")
fn:document-uri(/library)http://example.com/library.xml (assuming the document URI of the library + element is "http://example.com/library.xml")

+ W3C Documentation reference: Document-URI +
+ + + fn:base-uri(node?) +
+ Returns the base URI of the node or the context item
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node?Returns the base URI of the specified node or the context item (if no + argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:base-uri(/library/fiction:book[1])http://example.com/library.xml (assuming the base URI of the first + fiction:book element is "http://example.com/library.xml")
fn:base-uri(/library)http://example.com/library.xml (assuming the base URI of the library element + is "http://example.com/library.xml")

+ W3C Documentation reference: Base-URI +
+ + + fn:node-name(node?) +
+ + Returns the name of a node as an xs:QName
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node?Returns the name of the specified node or the context item if the argument + is omitted
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:node-name(/library/*[1])fiction:book
fn:node-name(/library/fiction:book[1]/title)title

+ W3C Documentation reference: Node-Name +
+ +
+
+
+ + + +
+ + fn:not(item()*) +
+ Returns the negation of the effective boolean value of the argument
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item()*Argument whose effective boolean value is to be negated
+ Examples:
+ + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
fn:not(1)false
fn:not(0)true
fn:not('')true
fn:not('true')false

+ W3C Documentation reference: Not +
+ + + fn:false() +
+ Returns the boolean value false
+ Arguments and return type: + + + + + + + + + +
TypeDescription
NoneReturns the boolean value false
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:false()false
//item[fn:false()]Returns an empty node-set

+ W3C Documentation reference: False +
+ + + fn:true() +
+ Returns the boolean value true
+ Arguments and return type: + + + + + + + + + +
TypeDescription
NoneReturns the boolean value true
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:true()true
//item[fn:true()]Returns all <item> elements

+ W3C Documentation reference: True +
+ + + fn:boolean(item()*) +
+ Converts the argument to a boolean value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item()*Argument to be converted to a boolean value
+ Examples:
+ + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
fn:boolean(1)true
fn:boolean(0)false
fn:boolean('')false
fn:boolean('true')true

+ W3C Documentation reference: Boolean +
+ + +
+
+
+ + + +
+ + fn:unparsed-text-available(xs:string?, xs:string?) +
+ Determines if an unparsed text resource identified by a URI can be read using the given + encoding
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the unparsed text resource
xs:string?The encoding to be used for reading the resource
xs:booleanIndicates if the resource can be read using the given encoding
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:unparsed-text-available("http://www.example.com/text.txt", "UTF-8")Returns true if the text resource identified by the specified URI can be + read using the specified encoding, otherwise false

+ W3C Documentation reference: unparsed-text-available +
+ + + fn:unparsed-text-lines(xs:string?, xs:string?) +
+ Returns the contents of an unparsed text resource identified by a URI, split into + lines
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the unparsed text resource
xs:string?The encoding to be used for reading the resource
xs:string*The lines of the unparsed text resource
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:unparsed-text-lines("http://www.example.com/text.txt", "UTF-8")Returns the lines of the text resource identified by the specified URI, + using the specified encoding

+ W3C Documentation reference: unparsed-text-lines +
+ + + fn:unparsed-text(xs:string?, xs:string?) +
+ Returns the contents of an unparsed text resource identified by a URI
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the unparsed text resource
xs:string?The encoding to be used for reading the resource
xs:string?The contents of the unparsed text resource
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:unparsed-text("http://www.example.com/text.txt", "UTF-8")Returns the contents of the text resource identified by the specified URI, + using the specified encoding

+ W3C Documentation reference: unparsed-text +
+ + + fn:escape-html-uri(xs:string?) +
+ Escapes special characters in a URI to be used in HTML
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?URI to be escaped for use in HTML
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:escape-html-uri('https://example.com/search?q=test&lang=en')https://example.com/search?q=test&lang=en
fn:escape-html-uri('https://example.com/page?id=1§ion=2')https://example.com/page?id=1&section=2

+ W3C Documentation reference: Escape-HTML-URI +
+ + + fn:iri-to-uri(xs:string?) +
+ Converts an IRI to a URI by escaping non-ASCII characters
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?IRI to be converted to a URI
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:iri-to-uri('https://example.com/ümlaut')https://example.com/%C3%BCmlaut
fn:iri-to-uri('https://example.com/日本語')https://example.com/%E6%97%A5%E6%9C%AC%E8%AA%9E

+ W3C Documentation reference: IRI-to-URI +
+ + + fn:encode-for-uri(xs:string?) +
+ Encodes a string for use in a URI by escaping special characters
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?String to be encoded for use in a URI
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:encode-for-uri('hello world')hello%20world
fn:encode-for-uri('example?query=value¶m=value2')example%3Fquery%3Dvalue%26param%3Dvalue2

+ W3C Documentation reference: Encode-for-URI +
+ + + fn:resolve-uri(xs:string?, xs:string?) +
+ Resolves a relative URI using a base URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Relative URI to resolve
xs:string?Base URI to use for resolving (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:resolve-uri('example.html', 'https://www.example.com/folder/')https://www.example.com/folder/example.html
fn:resolve-uri('../images/pic.jpg', + 'https://www.example.com/folder/page.html')https://www.example.com/images/pic.jpg

+ W3C Documentation reference: Resolve-URI +
+ + fn:analyze-string(xs:string?, xs:string, xs:string?) +
+ Analyzes the input string and returns an XML fragment containing match and non-match + elements
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to analyze
xs:stringRegular expression pattern to match
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:analyze-string('red,green,blue', ',') + <fn:analyze-string-result><fn:non-match>red</fn:non-match><fn:match>, + <fn:non-match>green</fn:non-match><fn:match>, + <fn:non-match>blue</fn:non-match></fn:analyze-string-result> +

+ W3C Documentation reference: Analyze-String +
+ + + fn:tokenize(xs:string?, xs:string, xs:string?) +
+ Splits the input string into a sequence of substrings using the pattern as a delimiter +
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to tokenize
xs:stringRegular expression pattern to use as delimiter
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:tokenize('XPath 3.0, XQuery 3.0, XSLT 3.0', ',\\s*')('XPath 3.0', 'XQuery 3.0', 'XSLT 3.0')
fn:tokenize('apple,orange,banana', ',')('apple', 'orange', 'banana')

+ W3C Documentation reference: Tokenize +
+ + + fn:replace(xs:string?, xs:string, xs:string, xs:string?) +
+ Replaces occurrences of the pattern in the input string with the replacement string
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:stringRegular expression pattern to match
xs:stringReplacement string
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:replace('XPath 3.0 is great', '3.0', '3.1')'XPath 3.1 is great'
fn:replace('Hello, World!', 'World', 'XPath')'Hello, XPath!'

+ W3C Documentation reference: Replace +
+ + + fn:matches(xs:string?, xs:string, xs:string?) +
+ Returns true if the input string matches the regular expression pattern, otherwise false +
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:stringRegular expression pattern to match
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:matches('XPath 3.0', '\\d\\.\\d')true
fn:matches('Hello, World!', '[A-Z][a-z]*')true
fn:matches('example123', '\\d+', 'q')false

+ W3C Documentation reference: Matches +
+ + + fn:substring-after(xs:string?, xs:string?) +
+ Returns the part of the first string that follows the first occurrence of the second + string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:string?Substring to search for
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:substring-after('Hello, World!', ',')' World!'
fn:substring-after('XPath 3.0 is awesome!', '3.0')' is awesome!'

+ W3C Documentation reference: Substring-After +
+ + + fn:substring-before(xs:string?, xs:string?) +
+ Returns the part of the first string that precedes the first occurrence of the second + string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:string?Substring to search for
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:substring-before('Hello, World!', ',')'Hello'
fn:substring-before('XPath 3.0 is awesome!', '3.0')'XPath '

+ W3C Documentation reference: Substring-Before +
+ + + fn:ends-with(xs:string?, xs:string?) +
+ Returns true if the first string ends with the second string, otherwise false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to check
xs:string?Substring to check for at the end of the first string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:ends-with('Hello, World!', 'World!')true
fn:ends-with('Hello, World!', 'Hello')false
fn:ends-with('XPath 3.0', '3.0')true

+ W3C Documentation reference: Ends-With +
+ + + fn:starts-with(xs:string?, xs:string?) +
+ Returns true if the first string starts with the second string, otherwise false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to check
xs:string?Substring to check for at the beginning of the first string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:starts-with('Hello, World!', 'Hello')true
fn:starts-with('Hello, World!', 'World')false
fn:starts-with('XPath 3.0', 'XPath')true

+ W3C Documentation reference: Starts-With +
+ + + fn:contains(xs:string?, xs:string?) +
+ Returns true if the first string contains the second string, otherwise false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:string?Substring to search for
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:contains('Hello, World!', 'World')true
fn:contains('Hello, World!', 'world')false
fn:contains('XPath 3.0', '3.0')true

+ W3C Documentation reference: Contains +
+ + + fn:translate(xs:string?, xs:string, xs:string) +
+ Returns the input string with specified characters replaced
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to be translated
xs:stringMap string with characters to replace
xs:stringTranslate string with replacement characters
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:translate('apple', 'aeiou', '12345')'1ppl2'
fn:translate('Hello, World!', 'HW', 'hw')'hello, world!'

+ W3C Documentation reference: Translate +
+ + + fn:lower-case(xs:string?) +
+ Returns the input string with all characters converted to lowercase
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to convert to lowercase
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:lower-case('HELLO, WORLD!')'hello, world!'
fn:lower-case('XPath 3.0')'xpath 3.0'
fn:lower-case('BANANA')'banana'

+ W3C Documentation reference: Lower-Case +
+ + + fn:upper-case(xs:string?) +
+ Returns the input string with all characters converted to uppercase
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to convert to uppercase
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:upper-case('Hello, World!')'HELLO, WORLD!'
fn:upper-case('XPath 3.0')'XPATH 3.0'
fn:upper-case('banana')'BANANA'

+ W3C Documentation reference: Upper-Case +
+ + + fn:normalize-unicode(xs:string?, xs:string) +
+ Returns the input string with Unicode normalization applied
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to normalize
xs:stringNormalization form to apply (NFC, NFD, NFKC, NFKD)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:normalize-unicode('Café', 'NFC')'Café'
fn:normalize-unicode('Café', 'NFD')'Café'

+ W3C Documentation reference: Normalize-Unicode +
+ + + fn:normalize-space(xs:string?) +
+ Returns the input string with whitespace normalized
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to normalize whitespace
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:normalize-space(' Hello, World! ')'Hello, World!'
fn:normalize-space(' XPath 3.0 ')'XPath 3.0'
fn:normalize-space('\tbanana\t')'banana'

+ W3C Documentation reference: Normalize-Space +
+ + + fn:string-length(xs:string?) +
+ Returns the length of the input string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to calculate length
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:string-length('Hello, World!')13
fn:string-length('XPath 3.0')8
fn:string-length('banana')6

+ W3C Documentation reference: String-Length +
+ + + fn:substring(xs:string?, xs:double) +
+ Returns a substring of the source string, starting from a specific location
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input source string
xs:doubleStarting location to extract the substring
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:substring('Hello, World!', 1, 5)'Hello'
fn:substring('XPath 3.0', 7)'3.0'
fn:substring('banana', 2, 3)'ana'

+ W3C Documentation reference: Substring +
+ + fn:string-join(xs:string*, xs:string) +
+ Joins a sequence of strings with a specified separator, returning a single string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*Input sequence of strings to join
xs:stringSeparator string to insert between joined strings
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:string-join(('apple', 'banana', 'orange'), ', ')'apple, banana, orange'
fn:string-join(('XPath', '3.0', 'Functions'), ' - ')'XPath - 3.0 - Functions'
fn:string-join(('A', 'B', 'C'), '')'ABC'

+ W3C Documentation reference: String-Join +
+ + + fn:concat(xs:anyAtomicType?, xs:anyAtomicType?, ...) +
+ Concatenates two or more strings or atomic values, returning a single string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:anyAtomicType?Input strings or atomic values to concatenate
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:concat('Hello', ' ', 'World')'Hello World'
fn:concat('I have ', 3, ' apples')'I have 3 apples'
fn:concat('XPath ', '3.0')'XPath 3.0'

+ W3C Documentation reference: Concat +
+ + + fn:codepoint-equal(xs:string?, xs:string?) +
+ Compares two strings on a codepoint-by-codepoint basis and returns true if they are + equal, false otherwise
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?First string to compare
xs:string?Second string to compare
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:codepoint-equal('Hello', 'Hello')true
fn:codepoint-equal('Hello', 'hello')false
fn:codepoint-equal('apple', 'banana')false

+ W3C Documentation reference: Codepoint-Equal +
+ + + fn:compare(xs:string?, xs:string?) +
+ Compares two strings and returns -1, 0, or 1 if the first string is less than, equal to, + or greater than the second string, respectively
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?First string to compare
xs:string?Second string to compare
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:compare('apple', 'banana')-1
fn:compare('apple', 'apple')0
fn:compare('banana', 'apple')1

+ W3C Documentation reference: Compare +
+ + + fn:string-to-codepoints(xs:string?) +
+ Returns a sequence of Unicode code points for a given string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:string-to-codepoints('Hello')(72, 101, 108, 108, 111)
fn:string-to-codepoints('( ͡° ͜ʖ ͡°)')(40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41)
fn:string-to-codepoints('😊')(128522)

+ W3C Documentation reference: String-To-Codepoints +
+ + + fn:codepoints-to-string(xs:integer*) +
+ Constructs a string from a sequence of Unicode code points
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:integer*Sequence of Unicode code points
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:codepoints-to-string((72, 101, 108, 108, 111))Hello
codepoints-to-string((40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41)) + ( ͡° ͜ʖ ͡°)
fn:codepoints-to-string((128522))😊

+ W3C Documentation reference: Codepoints-To-String +
+ + + + fn:string(object) +
Returns the string representation of the object argument
Arguments and return type: @@ -487,898 +7528,22 @@

W3C Documentation reference: String-Functions
+ +
- - - - [1.0] fn:string() -
-
- Returns a string value representation of the context node
-
- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:concat(string, string, string*) -
-
- Returns the concatenation of its arguments
- Arguments and return type: - - - - - - - - - - - - - - - - - -
TypeDescription
stringString to be merged
stringString to be merged
string*any number of strings
Examples:
- - - - - - - - - - - - - -
ExpressionResult
concat("aa","bb")aabb
concat("aa", 123)aa123

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:starts-with(string, string) -
-
- Returns true if the first string starts with the second string
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringString to be searched
stringString to be found
Examples:
- - - - - - - - - - - - - -
ExpressionResult
starts-with("aabb", "aa")true
starts-with("aabb", "cc")false

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:contains(string, string) -
-
- Returns true if the first string contains the second string
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringString to be searched
stringString to be found
Examples:
- - - - - - - - - - - - - -
ExpressionResult
contains("abc", "c")true
contains("abc", "1")false

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:substring-before(string, string) -
-
- Returns the substring found before the first occurrence of the second argument
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringString to be searched
stringString to be used to split
Examples:
- - - - - - - - - - - - - -
ExpressionResult
substring-before("aabbcc","bb")aa
substring-before("aabbcc","c")aabb

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:substring-after(string, string) -
-
- Returns the substring found after the first occurrence of the second argument
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringString to be searched
stringString to be used to split
Examples:
- - - - - - - - - - - - - -
ExpressionResult
substring-after("aabbcc","bb")cc
substring-after("aabbcc","a")abbcc

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:substring(string, number, number) -
-
- Returns the substring starting at second argument with lenght of third argument
- Arguments and return type: - - - - - - - - - - - - - - - - - -
TypeDescription
stringString to be cut
integerStarting position
integerLength of the substring
Examples:
- - - - - - - - - -
ExpressionResult
substring("aabbcc", 1, 2)aa

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:substring(string, number) -
-
- Returns the substring of the first argument from the position specified by the second - argument
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringString to be cut
integerStarting position
Examples:
- - - - - - - - - -
ExpressionResult
substring("aabbcc", 3)bbcc

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:string-length(string) -
-
- Returns the length of the string specified by the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
stringString of which length should be returned
Examples:
- - - - - - - - - - - - - -
ExpressionResult
string-length("aabbcc")6
string-length("aa bb cc")8

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:string-length() -
-
- Returns the length of the string specified by the context node
-
- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:normalize-space(string) -
-
- Returns a white-space normalized string
- Arguments and return type: - - - - - - - - - -
TypeDescription
stringString to be normalized
Examples:
- - - - - - - - - - - - - -
ExpressionResult
normalize-space("aa bb cc")aa bb cc
normalize-space("aa bb cc")aa bb cc

- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:normalize-space() -
-
- Returns a white-space normalized string specified by the context-node
-
- W3C Documentation reference: String-Functions -
-
- - - - [1.0] fn:translate(string, string, string) -
-
- Replaces characters specified by the second argument using those from the third argument -
- Arguments and return type: - - - - - - - - - - - - - - - - - -
TypeDescription
stringString to be edited
stringsequence of characters to be replaced
stringsequence of character to be used in replacement
Examples:
- - - - - - - - - - - - - -
ExpressionResult
translate("aabbcc", "ab","xz")xxzzcc
translate("Test sequence", "e","z")Tzst szquzncz

- W3C Documentation reference: String-Functions -
-
- - - - [2.0] fn:string-join((string,string,...),sep) -
-
- Returns a string created by concatenating the string arguments and using the sep - argument as the separator
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
string*string sequence to be joined
stringseparator to be used
Examples:
- - - - - - - - - - - - - -
ExpressionResult
string-join(('fox', 'jumps', 'over', 'dog'), ' ')' fox jumps over dog '
string-join(('fox', 'jumps', 'over', 'dog'))'joxjumpsoverdog'

- W3C Documentation reference: #func-string-join -
-
-
- - - [3.0] fn:string-to-codepoints(string) -
-
- Returns sequence of unicode codepoint representing the provided string
- Arguments and return type: - - - - - - - - - -
TypeDescription
stringstring to be coverted to list of unicode values
Examples:
- - - - - - - - - -
ExpressionResult
string-to-codepoints("test")(116, 101, 115, 116)

- W3C Documentation reference: #func-string-to-codepoints -
-
-
- - - [2.0] fn:compare(comp1,comp2) -
-
- Returns -1 if comp1 is less than comp2, 0 if comp1 is equal to comp2, or 1 if comp1 - is greater than comp2 (according to the rules of the collation that is used)
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringfirst parameter to be compared
stringsecond parameter to be compared
Examples:
- - - - - - - - - - - - - - - - - - - - - -
ExpressionResult
compare('abc', 'abc')0
compare('abc', 'abd')-1
compare('abc1', 'abd')-1
compare("abc1","abc")1

- W3C Documentation reference: #func-compare -
-
-
- - - [2.0] fn:compare(comp1,comp2,collation) -
-
- Returns -1 if comp1 is less than comp2, 0 if comp1 is equal to comp2, or 1 if comp1 - is greater than comp2 (according to the rules of the collation that is used)
- Arguments and return type: - - - - - - - - - - - - - - - - - -
TypeDescription
stringfirst parameter to be compared
stringsecond parameter to be compared
stringcollation to be used in comparison(letter weight may differ between - languages)
Examples:
- - - - - - - - - -
ExpressionResult
compare('ghi', 'ghi')0

- W3C Documentation reference: #func-compare -
-
-
- - - [2.0] fn:codepoints-to-string((int,int,...)) -
-
- Creates a string from a sequence of the Unicode Standard code points
- Arguments and return type: - - - - - - - - - -
TypeDescription
int*int sequence to be converted to string
Examples:
- - - - - - - - - -
ExpressionResult
codepoints-to-string((116, 101, 115, 116))'test'

- W3C Documentation reference: #func-codepoints-to-string -
-
-
- - - [2.0] fn:codepoint-equal(comp1,comp2) -
-
- Returns true if the value of comp1 is equal to the value of comp2, according to the - Unicode code point collation - (http://www.w3.org/2005/02/xpath-functions/collation/codepoint), otherwise it - returns false
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
intunicode codepoint
intunicode codepoint
Examples:
- - - - - - - - - - - - - - - - - -
ExpressionResult
codepoint-equal(111, 111)true
codepoint-equal(111, 112)false
codepoint-equal("111F", "111F")true

- W3C Documentation reference: #func-codepoint-equal -
-
-
- - - [2.0] fn:normalize-unicode() -
-
- NONE
-
- W3C Documentation reference: #func-normalize-unicode -
-
-
- - - [2.0] fn:upper-case(string) -
-
- Converts the string argument to upper-case
- Arguments and return type: - - - - - - - - - -
TypeDescription
stringstring to be converted to upper case
Examples:
- - - - - - - - - -
ExpressionResult
upper-case('aabbCC')'AABBCC'

- W3C Documentation reference: #func-upper-case -
-
-
- - - [2.0] fn:lower-case(string) -
-
- Converts the string argument to lower-case
- Arguments and return type: - - - - - - - - - -
TypeDescription
stringstring to be converted to upper case
Examples:
- - - - - - - - - -
ExpressionResult
lower-case('aabbCC')'aabbcc'

- W3C Documentation reference: #func-lower-case -
-
-
- - - [2.0] fn:escape-uri(stringURI,esc-res) -
-
- https://www.w3.org/TR/xpath-functions/#func-escape-uri
-
- W3C Documentation reference: #func-escape-uri -
-
-
- - - [2.0] fn:tokenize(string,pattern) -
-
- https://www.w3.org/TR/xpath-functions/#func-tokenize
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringstring to be tokenized
stringstring to be used to split the first argument
Examples:
- - - - - - - - - -
ExpressionResult
tokenize("fox jumps over dog", "s+")("fox", "jumps", "over", "dog")

- W3C Documentation reference: #func-tokenize -
-
-
- - - [2.0] fn:matches(string,pattern) -
-
- Returns true if the string argument matches the pattern, otherwise, it returns false -
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
stringstring to search in
stringpattern to be found
Examples:
- - - - - - - - - - - - - -
ExpressionResult
matches("Xpath", "pat")true
matches("Xpath", "abc")false

- W3C Documentation reference: #func-matches -
-
-
- - - [2.0] fn:replace(string,pattern,replace) -
-
- Returns a string that is created by replacing the given pattern with the replace - argument
-
- W3C Documentation reference: #func-replace -
-
-
- - - [2.0] fn:ends-with(string1,string2) -
-
- Returns true if string1 ends with string2, otherwise it returns false
-
- W3C Documentation reference: #func-ends-with -
-
-
- -
-
-
- - - -
- - - [1.0] fn:number(object) +
+ + +
-
- The number function converts its argument to a number as follows: -
    -
  • a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN
  • -
  • boolean true is converted to 1; boolean false is converted to 0
  • -
  • a node-set is first converted to a string as if by a call to the string function and then converted in the same way as a string argument
  • -
  • an object of a type other than the four basic types is converted to a number in a way that is dependent on that type
  • -
+ + fn:format-number(numeric?, xs:string, $decimal-format-name) +
+ Formats a numeric value according to the supplied picture string and optional decimal + format name
Arguments and return type: @@ -1386,37 +7551,45 @@ - - + + + + + + + + + +
Description
objectThe object to convert to a numbernumeric?Numeric value to be formatted
xs:stringPicture string defining the format
xs:string?Optional decimal format name
- Examples:
+ Examples:
- - + + - - + + + + + +
Expression Result
boolean("Release11")truefn:format-number(1234.567, '0.00')1,234.57
boolean("")falsefn:format-number(-1234.567, '0.00')-1,234.57
fn:format-number(0.12345, '0.00%')12.35%

- W3C Documentation reference: Numeric-Functions + W3C Documentation reference: Format-Number
-
- - [1.0] fn:sum(node-set) -
-
- The sum function returns the sum, for each node in the argument node-set, of the result of converting the string-values of the node to a number.
-
+ fn:format-integer(xs:integer?, xs:string) +
+ Formats an integer value according to the supplied picture string
Arguments and return type: @@ -1424,32 +7597,42 @@ - - + + + + + +
Description
node-setSet of nodes whose values will be summed.xs:integer?Integer value to be formatted
xs:stringPicture string defining the format
- Examples:
+ Examples:
- - + + + + + + + + + +
Expression Result
sum(/l:library/l:readerList/p:person/p:readerID)12444fn:format-integer(12345, '0,0')12,345
fn:format-integer(-1234, '0,0')-1,234
fn:format-integer(1234, '00-00-00')01-23-45

- W3C Documentation reference: Numeric-Functions + W3C Documentation reference: Format-Integer
-
- [1.0] fn:floor(number) -
-
- The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.
-
+ fn:round-half-to-even(numeric?) +
+ Returns the closest integer to the given numeric value, rounding half-way cases to the + nearest even integer (also known as "bankers' rounding")
Arguments and return type: @@ -1457,32 +7640,42 @@ - - + +
Description
numberNumber to convertnumeric?Numeric value for which the rounded value will be calculated
- Examples:
+ Examples:
- + + + + + -
Expression Result
floor(2.55)fn:round-half-to-even(3.5)4
fn:round-half-to-even(2.5) 2
- W3C Documentation reference: Numeric-Functions + + fn:round-half-to-even(-1.5) + -2 + + + fn:round-half-to-even(xs:decimal('1.25'), 1) + 1.2 + +
+ W3C Documentation reference: Round-Half-To-Even
-
- [1.0] fn:ceiling(number) -
-
- The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.
-
+ fn:round(numeric?) +
+ Returns the closest integer to the given numeric value, rounding half-way cases away + from zero
Arguments and return type: @@ -1490,1891 +7683,9431 @@ - - + +
Description
numberNumber to convertnumeric?Numeric value for which the rounded value will be calculated
- Examples:
+ Examples:
- - - -
Expression Result
ceiling(2.55)3
- W3C Documentation reference: Numeric-Functions -
-
- - [1.0] fn:round(number) -
-
- The round function returns the number that is closest to the argument and that is an integer. If there are two such numbers, then the one that is closest to positive infinity is returned. If the argument is NaN, then NaN is returned. If the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. 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, but greater than or equal to -0.5, then negative zero is returned.
- - NOTE: For these last two cases, the result of calling the round function is not the same as the result of adding 0.5 and then calling the floor function.
- Arguments and return type: - - - - - - - - - -
TypeDescription
numberNumber to convert
- Examples:
- - - - - - - + - + + + + + + + +
ExpressionResult
round(2.55)fn:round(3.14) 3
round(2.35)fn:round(-4.7)-5
fn:round(xs:decimal('2.5'))3

+ W3C Documentation reference: Round +
+ + + fn:floor(numeric?) +
+ Returns the largest integer less than or equal to the given numeric value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the floor value will be calculated
+ Examples:
+ + + + + + + + + + + + + + +
ExpressionResult
fn:floor(3.14)3
fn:floor(-4.7)-5
fn:floor(xs:decimal('2.5')) 2

- W3C Documentation reference: Numeric-Functions + W3C Documentation reference: Floor
+ + + + fn:ceiling(numeric?) +
+ Returns the smallest integer greater than or equal to the given numeric value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the ceiling value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:ceiling(3.14)4
fn:ceiling(-4.7)-4
fn:ceiling(xs:decimal('2.5'))3

+ W3C Documentation reference: Ceiling +
+ + + fn:abs(numeric?) +
+ Returns the absolute value of the given numeric value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the absolute value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:abs(-42)42
fn:abs(3.14)3.14
fn:abs(xs:decimal('-5.5'))5.5

+ W3C Documentation reference: Abs +
+ + fn:number(item?) +
+ Converts the given value to a number
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item?Returns the numeric value of the specified expression or the context item + (if no argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:number(/library/fiction:book[1]/@id)1 (if the first fiction:book element's id attribute is "1")
fn:number(/library/fiction:book[1]/price)19.99 (if the first fiction:book element's price element contains "19.99") +

+ W3C Documentation reference: Number +
+ + + +
- -
-
-
- - - -
- - - [2.0] fn:avg((arg,arg,...)) -
-
- Returns the average of the argument values
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequence*returns average value of provided elements
Examples:
- - - - - - - - - -
ExpressionResult
avg((1,2,3))2

- W3C Documentation reference: #func-avg -
-
+
+ + +
- - [2.0] fn:exactly-one(item,item,...) + fn:fold-right(item()*, item()*, function(item(), item()*))
-
- Returns the argument if it contains exactly one item, otherwise it raises an error -
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequencesequence to check
Examples:
- - - - - - - - - - - - - -
ExpressionResult
exactly-one((1))1
exactly-one((1,1))fn:exactly-one called with a sequence containing zero or more than one - item.

- W3C Documentation reference: #func-exactly-one -
+ Applies a processing function cumulatively to the items of a sequence from right to + left, so as to reduce the sequence to a single value
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
item()*The initial value, also known as the zero value
function(item(), item()*)The processing function used to accumulate the items
item()*The resulting single value after applying the processing function
+ Examples:
+ + + + + + + + + +
ExpressionResult
fold-right((1, 2, 3, 4), 0, function($current, $accumulator) { $accumulator + - $current })Returns the result of subtracting each number in the input sequence from + right to left: -2

+ W3C Documentation reference: fold-right
-
- - [2.0] fn:zero-or-one(item,item,...) + + fn:fold-left(item()*, item()*, function(item()*, item()))
-
- Returns the argument if it contains zero or one items, otherwise it raises an error -
-
- W3C Documentation reference: #func-zero-or-one -
+ Applies a processing function cumulatively to the items of a sequence from left to + right, so as to reduce the sequence to a single value
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
item()*The initial value, also known as the zero value
function(item()*, item())The processing function used to accumulate the items
item()*The resulting single value after applying the processing function
+ Examples:
+ + + + + + + + + +
ExpressionResult
fold-left((1, 2, 3, 4), 0, function($accumulator, $current) { $accumulator + + $current })Returns the sum of the numbers in the input sequence: 10

+ W3C Documentation reference: fold-left
-
- - [2.0] fn:index-of((item,item,...),searchitem) + + + + fn:last()
-
- Returns the positions within the sequence of items that are equal to the searchitem - argument
-
- W3C Documentation reference: #func-index-of -
+ Returns the position of the last item in the current context sequence
+ Arguments and return type: + + + + + + + + + +
TypeDescription
NoneReturns the position of the last item in the current context sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
/library/fiction:book[position() = last()]Returns the last fiction:book element in the library
/library/fiction:book[last()]Returns the last fiction:book element in the library

+ W3C Documentation reference: Last
-
- - [2.0] fn:reverse((item,item,...)) + fn:position()
-
- Returns the reversed order of the items specified
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequence*sequence of elements to have its order reversed
Examples:
- - - - - - - - - - - - - -
ExpressionResult
reverse(("ab", "cd", "ef"))("ef", "cd", "ab")
reverse(("ab"))("ab")

- W3C Documentation reference: #func-reverse -
+ Returns the context position of the context item in the sequence currently being + processed
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:integerThe position of the context item in the sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
<items><item>Item 1</item><item>Item + 2</item></items>/item[position()=2]Returns '<item>Item 2</item>'
<items><item>Item 1</item><item>Item + 2</item></items>/item[position()=1]Returns '<item>Item 1</item>'

+ W3C Documentation reference: position
-
- - [2.0] fn:one-or-more(item,item,...) + + fn:collection(xs:string?)
-
- Returns the argument if it contains one or more items, otherwise it raises an error -
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequencesequence to check
Examples:
- - - - - - - - - - - - - -
ExpressionResult
one-or-more((1, 2, 3))1 2 3
one-or-more()An empty sequence is not allowed as the first argument of - fn:one-or-more()

- W3C Documentation reference: #func-one-or-more -
+ Returns a sequence of documents in a collection identified by a URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the collection of documents
xs:anyAtomicType*A sequence of documents in the collection
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:collection("http://www.example.com/collection/")Returns a sequence of documents in the collection identified by the + specified URI
fn:collection()Returns a sequence of documents in the default collection, if one is defined +

+ W3C Documentation reference: collection
-
- - [2.0] fn:distinct-values((item,item,...),collation) + + fn:sum(xs:anyAtomicType*, xs:anyAtomicType?)
-
- Returns only distinct (different) values
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequencesequence to extract distinct values from
Examples:
- - - - - - - - - -
ExpressionResult
distinct-values((1, 2, 3, 1, 2))(1, 2, 3)

- W3C Documentation reference: #func-distinct-values -
+ Returns the sum of a sequence of numeric values
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of numeric values
xs:anyAtomicType?Value to return if the sequence is empty (optional)
xs:anyAtomicType?Sum of the input sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:sum((10, 20, 30, 40, 50))150
fn:sum((), 0)0

+ W3C Documentation reference: sum
-
- - [2.0] fn:exists(item,item,...) + + fn:min(xs:anyAtomicType*, xs:string)
-
- Returns true if the value of the arguments IS NOT an empty sequence, otherwise it - returns false
-
- W3C Documentation reference: #func-exists -
+ Returns the minimum value from a sequence of values
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of values
xs:stringCollation to use when comparing strings
xs:anyAtomicType?Minimum value in the input sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:min((10, 20, 30, 40, 50))10
fn:min(("apple", "banana", "cherry"), + "http://www.w3.org/2005/xpath-functions/collation/codepoint")"apple"
fn:min(())empty sequence

+ W3C Documentation reference: min
-
- - [2.0] fn:subsequence((item,item,...),start,len) + + fn:max(xs:anyAtomicType*, xs:string)
-
- Returns a sequence of items from the position specified by the start argument and - continuing for the number of items specified by the len argument. The first item is - located at position 1
-
- W3C Documentation reference: #func-subsequence -
+ Returns the maximum value from a sequence of values
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of values
xs:stringCollation to use when comparing strings
xs:anyAtomicType?Maximum value in the input sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:max((10, 20, 30, 40, 50))50
fn:max(("apple", "banana", "cherry"), + "http://www.w3.org/2005/xpath-functions/collation/codepoint")"cherry"
fn:max(())empty sequence

+ W3C Documentation reference: max
-
- - [2.0] fn:empty(item,item,...) + + fn:avg(xs:anyAtomicType*)
-
- Returns true if the value of the arguments IS an empty sequence, otherwise it - returns false
-
- W3C Documentation reference: #func-empty -
+ Computes the average of the numeric values in the input sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of numeric values
xs:anyAtomicType?Average of the numeric values in the input sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:avg((10, 20, 30, 40, 50))30
fn:avg((2.5, 3.5, 4.5))3.5
fn:avg(())empty sequence

+ W3C Documentation reference: avg
-
- - [2.0] fn:insert-before((item,item,...),pos,inserts) + + fn:count(item()*)
-
- Returns a new sequence constructed from the value of the item arguments
-
- W3C Documentation reference: #func-insert-before -
+ Returns the number of items in the input sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
xs:integerNumber of items in the input sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:count(('apple', 'banana', 'orange'))3
fn:count(())0
fn:count((1, 2, 3, 4, 5))5

+ W3C Documentation reference: count
-
- - [2.0] fn:remove((item,item,...),position) + + fn:exactly-one(item()*)
-
- Returns a new sequence constructed from the value of the item arguments
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
sequence*sequence to be modified
integerposition to insert element from
Examples:
- - - - - - - - - - - - - -
ExpressionResult
remove(("a","b","c"), 1)b c
remove(("a","b","c"), 0)a b c

- W3C Documentation reference: #func-remove -
+ Returns the single item in the input sequence or raises an error if the sequence is + empty or contains more than one item
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()Single item from the input sequence, otherwise an error is raised
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:exactly-one(('apple'))'apple'
fn:exactly-one(('apple', 'banana'))Error (more than one item)
fn:exactly-one(())Error (empty sequence)

+ W3C Documentation reference: exactly-one
-
- - [2.0] fn:unordered((item,item,...)) + + fn:one-or-more(item()*)+
-
- Returns the items in an implementation dependent order
-
- W3C Documentation reference: #func-unordered -
+ Returns the input sequence if it contains one or more items, otherwise raises an + error
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()+Sequence containing one or more items, otherwise an error is raised
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:one-or-more(('apple', 'banana'))('apple', 'banana')
fn:one-or-more(('pear'))('pear')

+ W3C Documentation reference: one-or-more
-
- - [2.0] fn:data(item.item,...) + + fn:zero-or-one(item()*)
-
- Takes a sequence of items and returns a sequence of atomic values
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequence*sequence to be split to atomic values
Examples:
- - - - - - - - - -
ExpressionResult
data((1,2,23, "test"))1 2 23 test

- W3C Documentation reference: #func-data -
+ Returns the input sequence if it contains zero or one items, otherwise raises an + error
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()?Sequence containing zero or one item, otherwise an error is raised
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:zero-or-one(('apple'))('apple')
fn:zero-or-one(())()

+ W3C Documentation reference: zero-or-one
-
- - [2.0] fn:collection() + + fn:deep-equal(item()* , item()*)
-
- NONE
-
- W3C Documentation reference: #func-collection -
+ Returns true if the two input sequences are deep-equal, meaning that they have the same + structure and atomic values
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*First input sequence
item()*Second input sequence
xs:booleanTrue if the input sequences are deep-equal, otherwise false
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:deep-equal((1, 2, 3), (1, 2, 3))true
fn:deep-equal((1, 2, 3), (1, 2, 4))false

+ W3C Documentation reference: deep-equal
-
- - [2.0] fn:collection(string) + + fn:index-of(xs:anyAtomicType*, xs:anyAtomicType)
-
- NONE
-
- W3C Documentation reference: #func-collection -
+ Returns a sequence of integers indicating the positions of items in the input sequence + that are equal to the search item
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of atomic values
xs:anyAtomicTypeSearch item to find in the input sequence
xs:integer*Sequence of integers representing the positions of the search item in the + input sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:index-of((3, 1, 4, 1, 5, 9, 2, 2, 3), 1)(2, 4)
fn:index-of(('apple', 'banana', 'orange', 'apple', 'grape', 'orange'), + 'apple')(1, 4)

+ W3C Documentation reference: index-of
-
- - [2.0] fn:min((arg,arg,...)) + + fn:distinct-values(xs:anyAtomicType*)
-
- Returns the argument that is less than the others
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequence*sequence to select minimum from
Examples:
- - - - - - - - - - - - - -
ExpressionResult
min((1,2,3))1
min(('a', 'k'))'a'

- W3C Documentation reference: #func-min -
+ Returns a sequence of distinct atomic values from the input sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of atomic values
xs:anyAtomicType*Distinct sequence of atomic values
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:distinct-values((3, 1, 4, 1, 5, 9, 2, 2, 3))(3, 1, 4, 5, 9, 2)
fn:distinct-values(('apple', 'banana', 'orange', 'apple', 'grape', + 'orange'))('apple', 'banana', 'orange', 'grape')

+ W3C Documentation reference: distinct-values
-
- - [2.0] fn:max((arg,arg,...)) + + fn:unordered(item()*)
-
- Returns the argument that is greater than the others
- Arguments and return type: - - - - - - - - - -
TypeDescription
sequence*sequence to select maximum from
Examples:
- - - - - - - - - - - - - -
ExpressionResult
max((1,2,3))3
max(('a', 'k'))'k'

- W3C Documentation reference: #func-max -
+ Returns the items of a sequence in an implementation-dependent order
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()*Unordered sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:unordered((3, 1, 4, 1, 5, 9, 2))(1, 2, 3, 4, 5, 9, 1) (example result; actual order may vary)
fn:unordered(('apple', 'banana', 'orange', 'grape'))('banana', 'apple', 'orange', 'grape') (example result; actual order may + vary)

+ W3C Documentation reference: unordered
-
- - [2.0] fn:deep-equal(param1,param2,collation) + + fn:subsequence(item()*, xs:double, xs:double)
-
- Returns true if param1 and param2 are deep-equal to each other, otherwise it returns - false
-
- W3C Documentation reference: #func-deep-equal -
+ Returns a subsequence of a given sequence starting at a specified position with a + specified length
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
xs:doubleStarting position
xs:doubleLength of subsequence
item()*Subsequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:subsequence((1, 2, 3, 4, 5), 2, 3)(2, 3, 4)
fn:subsequence(('apple', 'banana', 'orange', 'grape'), 1, 2)('apple', 'banana')
fn:subsequence(('red', 'blue', 'green', 'yellow'), 3)('green', 'yellow')

+ W3C Documentation reference: subsequence
-
+ fn:reverse(item()*) +
+ Reverses the order of items in a sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()*Reversed sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:reverse((1, 2, 3, 4))(4, 3, 2, 1)
fn:reverse(('apple', 'banana', 'orange'))('orange', 'banana', 'apple')
fn:reverse(('red', 'blue', 'green'))('green', 'blue', 'red')

+ W3C Documentation reference: reverse +
+ + + fn:remove(item()*, xs:integer) +
+ Removes an item from a sequence at the specified position
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*Target sequence
xs:integerPosition of the item to remove
item()*New sequence with the item removed
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:remove((1, 2, 3, 4), 2)(1, 3, 4)
fn:remove(('apple', 'banana', 'orange'), 3)('apple', 'banana')
fn:remove((10, 20, 30), 1)(20, 30)

+ W3C Documentation reference: remove +
+ + + fn:insert-before(item()*, xs:integer, item()*) +
+ Inserts items from the specified sequence into another sequence at a given position
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*Target sequence
xs:integerPosition at which to insert the items
item()*Sequence of items to insert
item()*New sequence with items inserted
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:insert-before((1, 3, 4), 2, (2))(1, 2, 3, 4)
fn:insert-before(('apple', 'orange'), 1, ('banana'))('banana', 'apple', 'orange')
fn:insert-before((10, 20, 30), 4, (40))(10, 20, 30, 40)

+ W3C Documentation reference: insert-before +
+ + + fn:tail(item()*) +
+ Returns all items of the input sequence except the first one, or an empty sequence if + the input is empty or contains only one item
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
item()*All items except the first one, or an empty sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:tail((1, 2, 3))(2, 3)
fn:tail((1))()
fn:tail(/books/book/author)All authors in the "books" element except the first one

+ W3C Documentation reference: tail +
+ + + fn:head(item()*) +
+ Returns the first item of the input sequence, or an empty sequence if the input is + empty
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
item()?The first item of the sequence, or an empty sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:head((1, 2, 3))1
fn:head(())()
fn:head(/books/book[1]/author)The first author of the first book in the "books" element

+ W3C Documentation reference: head +
+ + + fn:exists(item()*) +
+ Returns true if the input sequence is not empty, otherwise returns false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
xs:booleanResult of the test (true or false)
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:exists((1, 2, 3))true
fn:exists(())false
fn:exists(//chapter[5])true if there are at least 5 chapters, otherwise false

+ W3C Documentation reference: exists +
+ + + fn:empty(item()*) +
+ Returns true if the input sequence is empty, otherwise returns false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
xs:booleanResult of the test (true or false)
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:empty((1, 2, 3))false
fn:empty(())true
fn:empty(//chapter[100])true if there are less than 100 chapters, otherwise false

+ W3C Documentation reference: empty +
+ + + + + fn:data(item*) +
+ Returns the simple value of an item or a sequence of items
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item?Returns the simple value of the specified item or the context item (if no + argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:data(/library/fiction:book[1]/title)The Catcher in the Rye
fn:data(/library/fiction:book[2]/author)Harper Lee

+ W3C Documentation reference: Data +
+ + +
-
-
- - - -
- - - [2.0] fn:adjust-date-to-timezone(date,timezone) -
-
- If the timezone argument is empty, it returns a date without a timezone. Otherwise, - it returns a date with a timezone
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
datedate to be adjusted
timezonetimezone to be imposed into date
Examples:
- - - - - - - - - -
ExpressionResult
adjust-date-to-timezone(xs:date('2011-11-15'), - xs:dayTimeDuration("PT10H"))2011-11-15+10:00

- W3C Documentation reference: #func-adjust-date-to-timezone -
-
+
+ + - - - [2.0] fn:adjust-time-to-timezone(time,timezone) -
-
- If the timezone argument is empty, it returns a time without a timezone. Otherwise, - it returns a time with a timezone
-
- W3C Documentation reference: #func-adjust-time-to-timezone -
-
-
- - - [2.0] + fn:implicit-timezone()
-
- Returns the value of the implicit timezone
- Examples:
- - - - - - - - - -
ExpressionResult
implicit-timezone()PT1H

- W3C Documentation reference: #func-implicit-timezone -
+ Returns the implicit timezone as an xs:dayTimeDuration
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:dayTimeDurationThe implicit timezone as a dayTimeDuration
+ Examples:
+ + + + + + + + + +
ExpressionResult
implicit-timezone()Returns the implicit timezone as an xs:dayTimeDuration, e.g., '-PT7H' +

+ W3C Documentation reference: implicit-timezone
-
- - [2.0] fn:dateTime(date,time) -
-
- Converts the arguments to a date and a time
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
datedate to be merged into dateTime
timetime to be merged into dateTime
Examples:
- - - - - - - - - -
ExpressionResult
dateTime(xs:date("2011-11-15"), xs:time("10:22:00"))2011-11-15T10:22:00

- W3C Documentation reference: #func-dateTime -
-
-
- - [2.0] fn:current-time()
-
- Returns the current time (with timezone)
- Examples:
- - - - - - - - - -
ExpressionResult
current-time()11:48:04.393361+01:00

- W3C Documentation reference: #func-current-time -
+ Returns the current time with timezone
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:timeThe current time with timezone
+ Examples:
+ + + + + + + + + +
ExpressionResult
current-time()Returns the current time with timezone, e.g., '13:45:30.123-07:00'

+ W3C Documentation reference: current-time
-
- - [2.0] fn:timezone-from-time(time) -
-
- Returns the time zone component of the argument if any
- Arguments and return type: - - - - - - - - - -
TypeDescription
timetime to extract timezone infromation from
Examples:
- - - - - - - - - -
ExpressionResult
timezone-from-time(xs:time("10:22:00+10:00"))PT10H

- W3C Documentation reference: #func-timezone-from-time -
-
-
- - [2.0] fn:hours-from-time(time) -
-
- Returns an integer that represents the hours component in the localized value of the - argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
timetime to extact hours component from
Examples:
- - - - - - - - - -
ExpressionResult
hours-from-time(xs:time("10:22:00"))10

- W3C Documentation reference: #func-hours-from-time -
-
-
- - - [2.0] fn:minutes-from-time(time) -
-
- Returns an integer that represents the minutes component in the localized value of - the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
timetime to extract minutes component from
Examples:
- - - - - - - - - -
ExpressionResult
minutes-from-time(xs:time("10:22:00"))22

- W3C Documentation reference: #func-minutes-from-time -
-
-
- - - [2.0] fn:seconds-from-time(time) -
-
- Returns an integer that represents the seconds component in the localized value of - the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
timeTime to convert to seconds
Examples:
- - - - - - - - - -
ExpressionResult
seconds-from-time(xs:time("10:22:00"))0

- W3C Documentation reference: #func-seconds-from-time -
-
-
- - - [2.0] fn:years-from-duration(datetimedur) -
-
- Returns an integer that represents the years component in the canonical lexical - representation of the value of the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedurdatetimedur to extract years component from
Examples:
- - - - - - - - - -
ExpressionResult
years-from-duration(xs:duration("P5Y2DT10H59M"))5

- W3C Documentation reference: #func-years-from-duration -
-
-
- - - [2.0] fn:months-from-duration(datetimedur) -
-
- Returns an integer that represents the months component in the canonical lexical - representation of the value of the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedurdatetimedur to extract months component from
Examples:
- - - - - - - - - -
ExpressionResult
months-from-duration(xs:duration("P5Y10M2DT10H59M"))10

- W3C Documentation reference: #func-years-from-duration -
-
-
- - - [2.0] fn:days-from-duration(datetimedur) -
-
- Returns an integer that represents the days component in the canonical lexical - representation of the value of the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedurdatetimedur to extract days component from
Examples:
- - - - - - - - - -
ExpressionResult
days-from-duration(xs:duration("P5Y2DT10H59M"))2

- W3C Documentation reference: #func-days-from-duration -
-
-
- - - [2.0] fn:hours-from-duration(datetimedur) -
-
- Returns an integer that represents the hours component in the canonical lexical - representation of the value of the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedurdatetimedur to extract hours component from
Examples:
- - - - - - - - - -
ExpressionResult
hours-from-duration(xs:duration("P5Y2DT10H59M"))10

- W3C Documentation reference: #func-hours-from-duration -
-
-
- - - [2.0] fn:minutes-from-duration(datetimedur) -
-
- Returns an integer that represents the minutes component in the canonical lexical - representation of the value of the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedurdatetimedur to extract minute component from
Examples:
- - - - - - - - - -
ExpressionResult
years-from-duration(xs:duration("P5Y2DT10H59M"))59

- W3C Documentation reference: #func-minutes-from-duration -
-
-
- - - [2.0] fn:seconds-from-duration(datetimedur) -
-
- Returns a decimal that represents the seconds component in the canonical lexical - representation of the value of the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedurdatetimedur to extract seconds component from
Examples:
- - - - - - - - - -
ExpressionResult
days-from-duration(xs:duration("P5Y2DT10H59M40S"))40

- W3C Documentation reference: #func-seconds-from-duration -
-
-
- - - [2.0] fn:current-date()
-
- Returns the current date (with timezone)
-
- W3C Documentation reference: #func-current-date -
+ Returns the current date with timezone
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:dateThe current date with timezone
+ Examples:
+ + + + + + + + + +
ExpressionResult
current-date()Returns the current date with timezone, e.g., '2023-03-29-07:00'

+ W3C Documentation reference: current-date
-
- - [2.0] fn:timezone-from-date(date) -
-
- Returns the time zone component of the argument if any
- Arguments and return type: - - - - - - - - - -
TypeDescription
datedate to extract timezone information from
Examples:
- - - - - - - - - - - - - -
ExpressionResult
timezone-from-date(xs:date("2011-11-15+11:00"))PT1H
timezone-from-date(xs:date("2011-11-15+11:00"))PT11H

- W3C Documentation reference: #func-timezone-from-date -
-
-
- - [2.0] fn:year-from-date(date) -
-
- Returns an integer that represents the year in the localized value of the argument -
- Arguments and return type: - - - - - - - - - -
TypeDescription
datedate to extract years component from
Examples:
- - - - - - - - - -
ExpressionResult
year-from-date(xs:date("2011-11-15"))2011

- W3C Documentation reference: #func-year-from-date -
-
-
- - - [2.0] fn:month-from-date(date) -
-
- Returns an integer that represents the month in the localized value of the argument -
- Arguments and return type: - - - - - - - - - -
TypeDescription
dateDate to extrat the month from
Examples:
- - - - - - - - - -
ExpressionResult
month-from-date(xs:date("2011-11-15"))11

- W3C Documentation reference: #func-month-from-date -
-
-
- - - [2.0] fn:day-from-date(date) -
-
- Returns an integer that represents the day in the localized value of the argument -
- Arguments and return type: - - - - - - - - - -
TypeDescription
datedate to extact day component from
Examples:
- - - - - - - - - -
ExpressionResult
day-from-date(xs:date("2011-04-23"))23

- W3C Documentation reference: #func-day-from-date -
-
-
- - - [2.0] fn:current-dateTime()
-
- Returns the current dateTime (with timezone)
- Examples:
- - - - - - - - - -
ExpressionResult
current-dateTime()2021-03-24T18:15:09.808+01:00

- W3C Documentation reference: #func-current-dateTime -
+ Returns the current date and time with timezone
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:dateTimeThe current date and time with timezone
+ Examples:
+ + + + + + + + + +
ExpressionResult
current-dateTime()Returns the current date and time with timezone, e.g., + '2023-03-29T12:34:56.789-07:00'

+ W3C Documentation reference: current-dateTime
-
- - [2.0] fn:timezone-from-dateTime(datetime) + + fn:format-time(xs:time?, xs:string, xs:string?, xs:string?, xs:string?)
-
- Returns the time zone component of the argument if any
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimeDateTime to extract fimezone information from
Examples:
- - - - - - - - - -
ExpressionResult
timezone-from-dateTime(xs:dateTime("2021-01-15T12:10:00-03:00"))-PT3H

- W3C Documentation reference: #func-timezone-from-dateTime -
+ Formats a time value using the provided picture string and optional language, + calendar, and country settings
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:time?Time value
xs:stringPicture string
xs:string?Language
xs:string?Calendar
xs:string?Country
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:format-time(xs:time('14:30:15'), '[H01]:[m01]:[s01]')14:30:15
fn:format-time(xs:time('14:30:15'), '[h01] [P] [ZN,*-3]')02 PM UTC

+ W3C Documentation reference: Format-Time
-
- - [2.0] fn:year-from-dateTime(datetime) + + fn:format-date(xs:date?, xs:string, xs:string?, xs:string?, xs:string?)
-
- Returns an integer that represents the year component in the localized value of the - argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedatetime to extract years component from
Examples:
- - - - - - - - - -
ExpressionResult
year-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10"))2011

- W3C Documentation reference: #func-year-from-dateTime -
+ Formats a date value using the provided picture string and optional language, + calendar, and country settings
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:date?Date value
xs:stringPicture string
xs:string?Language
xs:string?Calendar
xs:string?Country
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:format-date(xs:date('2023-04-01'), '[Y0001]-[M01]-[D01]')2023-04-01
fn:format-date(xs:date('2023-04-01'), '[MNn,*-3] [D], [Y]')Apr 1, 2023

+ W3C Documentation reference: Format-Date
-
- - [2.0] fn:month-from-dateTime(datetime) + + fn:format-dateTime(xs:dateTime?, xs:string, xs:string?, xs:string?, xs:string?)
-
- Returns an integer that represents the month component in the localized value of the - argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedatetime to extract month component from
Examples:
- - - - - - - - - -
ExpressionResult
month-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10"))11

- W3C Documentation reference: #func-month-from-dateTime -
+ Formats a dateTime value using the provided picture string and optional language, + calendar, and country settings
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
xs:stringPicture string
xs:string?Language
xs:string?Calendar
xs:string?Country
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:format-dateTime(xs:dateTime('2023-04-01T12:00:00'), + '[Y0001]-[M01]-[D01] [H01]:[m01]:[s01]')2023-04-01 12:00:00
fn:format-dateTime(xs:dateTime('2023-04-01T12:00:00'), '[MNn,*-3], [D], + [Y]')Apr, 1, 2023

+ W3C Documentation reference: Format-DateTime
-
- - [2.0] fn:day-from-dateTime(datetime) + + fn:adjust-time-to-timezone(xs:time?, xs:dayTimeDuration?)
-
- Returns an integer that represents the day component in the localized value of the - argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedatetime to extract day component from
Examples:
- - - - - - - - - -
ExpressionResult
day-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10"))15

- W3C Documentation reference: #func-day-from-dateTime -
+ Adjusts the timezone of a time value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:time?Time value
xs:dayTimeDuration?Timezone adjustment
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:adjust-time-to-timezone(xs:time('10:00:00-07:00'), + xs:dayTimeDuration('PT2H'))12:00:00-05:00
fn:adjust-time-to-timezone(xs:time('10:00:00Z'), + xs:dayTimeDuration('-PT3H'))07:00:00-03:00

+ W3C Documentation reference: Adjust-Time-To-Timezone
-
- - [2.0] fn:hours-from-dateTime(datetime) + + + + fn:adjust-date-to-timezone(xs:date?, xs:dayTimeDuration?)
-
- Returns an integer that represents the hours component in the localized value of the - argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedatetime to extract hours component from
Examples:
- - - - - - - - - -
ExpressionResult
hours-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10"))12

- W3C Documentation reference: #func-hours-from-dateTime -
+ Adjusts the timezone of a date value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:date?Date value
xs:dayTimeDuration?Timezone adjustment
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:adjust-date-to-timezone(xs:date('2023-01-01-07:00'), + xs:dayTimeDuration('PT2H'))2023-01-01-05:00
fn:adjust-date-to-timezone(xs:date('2023-01-01Z'), + xs:dayTimeDuration('-PT3H'))2022-12-31-03:00

+ W3C Documentation reference: Adjust-Date-To-Timezone
-
- - [2.0] fn:minutes-from-dateTime(datetime) + + fn:adjust-dateTime-to-timezone(xs:dateTime?, xs:dayTimeDuration?)
-
- Returns an integer that represents the minutes component in the localized value of - the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedatetime to extract minutes component from
Examples:
- - - - - - - - - -
ExpressionResult
minutes-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10"))30

- W3C Documentation reference: #func-minutes-from-dateTime -
+ Adjusts the timezone of a dateTime value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
xs:dayTimeDuration?Timezone adjustment
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:adjust-dateTime-to-timezone(xs:dateTime('2023-01-01T12:00:00-07:00'), + xs:dayTimeDuration('PT2H'))2023-01-01T17:00:00-05:00
fn:adjust-dateTime-to-timezone(xs:dateTime('2023-01-01T12:00:00Z'), + xs:dayTimeDuration('-PT3H'))2023-01-01T09:00:00-03:00

+ W3C Documentation reference: Adjust-DateTime-To-Timezone
-
- - [2.0] fn:seconds-from-dateTime(datetime) + + fn:timezone-from-time(xs:time?)
-
- Returns a decimal that represents the seconds component in the localized value of - the argument
- Arguments and return type: - - - - - - - - - -
TypeDescription
datetimedatetime to extract seconds component from
Examples:
- - - - - - - - - -
ExpressionResult
seconds-from-dateTime(xs:dateTime("2011-11-15T12:30:00-04:10"))0

- W3C Documentation reference: #func-seconds-from-dateTime -
+ Extracts the timezone component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:timezone-from-time(xs:time('12:00:00-07:00'))-PT7H
fn:timezone-from-time(xs:time('14:30:00+02:30'))PT2H30M

+ W3C Documentation reference: Timezone-From-Time
-
- - [2.0] fn:adjust-dateTime-to-timezone(datetime,timezone) + + fn:seconds-from-time(xs:time?)
-
- If the timezone argument is empty, it returns a dateTime without a timezone. - Otherwise, it returns a dateTime with a timezone
- Arguments and return type: - - - - - - - - - - - - - -
TypeDescription
datetimedatetime to be adjusted
timezonetimezone to be used in provided date
Examples:
- - - - - - - - - -
ExpressionResult
adjust-dateTime-to-timezone(xs:dateTime('2011-11-15T12:30:00-04:10'), - xs:dayTimeDuration("PT10H"))2011-11-16T02:40:00+10:00

- W3C Documentation reference: #func-adjust-dateTime-to-timezone -
+ Extracts the seconds component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:seconds-from-time(xs:time('21:45:30.5'))30.5
fn:seconds-from-time(xs:time('04:15:12.1'))12.1

+ W3C Documentation reference: Seconds-From-Time
-
+ fn:minutes-from-time(xs:time?) +
+ Extracts the minutes component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:minutes-from-time(xs:time('21:45:30'))45
fn:minutes-from-time(xs:time('04:15:12'))15

+ W3C Documentation reference: Minutes-From-Time +
+ + + fn:hours-from-time(xs:time?) +
+ Extracts the hours component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:hours-from-time(xs:time('21:45:30'))21
fn:hours-from-time(xs:time('04:15:12'))4

+ W3C Documentation reference: Hours-From-Time +
+ + + fn:timezone-from-date(xs:date?) +
+ Extracts the timezone component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:timezone-from-date(xs:date('2023-03-29+02:00'))PT2H
fn:timezone-from-date(xs:date('1980-12-15-05:00'))-PT5H

+ W3C Documentation reference: Timezone-From-Date +
+ + + fn:day-from-date(xs:date?) +
+ Extracts the day component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:day-from-date(xs:date('2023-03-29'))29
fn:day-from-date(xs:date('1980-12-15'))15

+ W3C Documentation reference: Day-From-Date +
+ + + fn:month-from-date(xs:date?) +
+ Extracts the month component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:month-from-date(xs:date('2023-03-29'))3
fn:month-from-date(xs:date('1980-12-15'))12

+ W3C Documentation reference: Month-From-Date +
+ + + fn:year-from-date(xs:date?) +
+ Extracts the year component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:year-from-date(xs:date('2023-03-29'))2023
fn:year-from-date(xs:date('1980-12-15'))1980

+ W3C Documentation reference: Year-From-Date +
+ + + fn:timezone-from-dateTime(xs:dateTime?) +
+ Extracts the timezone component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:timezone-from-dateTime(xs:dateTime('2023-03-29T12:30:45-07:00'))-PT7H
fn:timezone-from-dateTime(xs:dateTime('2023-12-15T18:45:30+03:30'))PT3H30M

+ W3C Documentation reference: Timezone-From-DateTime +
+ + + fn:seconds-from-dateTime(xs:dateTime?) +
+ Extracts the seconds component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:seconds-from-dateTime(xs:dateTime('2023-03-29T12:30:45'))45
fn:seconds-from-dateTime(xs:dateTime('2023-12-15T18:45:30.5-08:00')) + 30.5

+ W3C Documentation reference: Seconds-From-DateTime +
+ + + fn:minutes-from-dateTime(xs:dateTime?) +
+ Extracts the minutes component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:minutes-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))30
fn:minutes-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))45

+ W3C Documentation reference: Minutes-From-DateTime +
+ + + fn:hours-from-dateTime(xs:dateTime?) +
+ Extracts the hours component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:hours-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))12
fn:hours-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))18

+ W3C Documentation reference: Hours-From-DateTime +
+ + + fn:day-from-dateTime(xs:dateTime?) +
+ Extracts the day component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:day-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))29
fn:day-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))15

+ W3C Documentation reference: Day-From-DateTime +
+ + + fn:month-from-dateTime(xs:dateTime?) +
+ Extracts the month component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:month-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))3
fn:month-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))12

+ W3C Documentation reference: Month-From-DateTime +
+ + + fn:year-from-dateTime(xs:dateTime?) +
+ Extracts the year component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:year-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))2023
fn:year-from-dateTime(xs:dateTime('2023-03-29T12:30:00-08:00'))2023

+ W3C Documentation reference: Year-From-DateTime +
+ + + + + fn:dateTime(xs:date?, xs:time?) +
+ Constructs an xs:dateTime value from an xs:date and an xs:time value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:date?Date value
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:dateTime(xs:date('2023-03-29'), xs:time('12:30:00'))2023-03-29T12:30:00
fn:dateTime(xs:date('2023-03-29+05:00'), xs:time('12:30:00-08:00'))2023-03-29T12:30:00-08:00

+ W3C Documentation reference: DateTime +
+ + + fn:seconds-from-duration(xs:duration?) +
+ Returns the seconds component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the seconds component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:seconds-from-duration(xs:dayTimeDuration('PT1H30M15.5S'))15.5
fn:seconds-from-duration(xs:dayTimeDuration('-PT2M10.3S'))-10.3

+ W3C Documentation reference: Seconds-From-Duration +
+ + + fn:minutes-from-duration(xs:duration?) +
+ Returns the minutes component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the minutes component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:minutes-from-duration(xs:dayTimeDuration('PT2H30M'))30
fn:minutes-from-duration(xs:dayTimeDuration('-PT1H45M'))-45

+ W3C Documentation reference: Minutes-From-Duration +
+ + + fn:hours-from-duration(xs:duration?) +
+ Returns the hours component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the hours component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:hours-from-duration(xs:dayTimeDuration('PT36H'))36
fn:hours-from-duration(xs:dayTimeDuration('-PT12H30M'))-12

+ W3C Documentation reference: Hours-From-Duration +
+ + + fn:days-from-duration(xs:duration?) +
+ Returns the days component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the days component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:days-from-duration(xs:dayTimeDuration('P5DT12H30M'))5
fn:days-from-duration(xs:dayTimeDuration('-P2DT6H'))-2

+ W3C Documentation reference: Days-From-Duration +
+ + + + fn:months-from-duration(xs:duration?) +
+ Returns the months component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the months component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:months-from-duration(xs:duration('P2Y3M4DT5H6M7S'))3
fn:months-from-duration(xs:duration('-P2Y3M4DT5H6M7S'))-3

+ W3C Documentation reference: Months-From-Duration +
+ + + fn:years-from-duration(xs:duration?) +
+ Returns the years component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the years component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:years-from-duration(xs:duration('P2Y3M4DT5H6M7S'))2
fn:years-from-duration(xs:duration('-P2Y3M4DT5H6M7S'))-2

+ W3C Documentation reference: Years-From-Duration +
+
-
-
- - - -
- - - [2.0] fn:error() -
-
- https://www.w3.org/TR/xpath-functions/#func-error
-
- W3C Documentation reference: #func-error -
-
+
+ + +
- - [2.0] fn:error(error) + fn:trace(item()*, xs:string)
-
- https://www.w3.org/TR/xpath-functions/#func-error
-
- W3C Documentation reference: #func-error -
+ Outputs the provided label and value for diagnostic purposes and returns the value + unchanged
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Value to be traced
xs:stringLabel to be output along with the value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:trace(42, 'The value is:')Outputs "The value is: 42" for diagnostic purposes and returns 42
fn:trace(/library/book/title, 'Book title:')Outputs "Book title: [book title]" for diagnostic purposes and returns + the book title

+ W3C Documentation reference: Trace
-
- - [2.0] fn:error(error,description) + + fn:error(xs:QName?, xs:string?, $error-object)
-
- https://www.w3.org/TR/xpath-functions/#func-error
-
- W3C Documentation reference: #func-error -
+ Raises an error with the specified error code, description, and error object
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:QName?Error code (optional)
xs:string?Description of the error (optional)
item()*Error object (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:error(xs:QName('err:FOER0000'))Raise error with the code err:FOER0000
fn:error(xs:QName('err:FOER0000'), 'Invalid value')Raise error with the code err:FOER0000 and description "Invalid value" +

+ W3C Documentation reference: Error
-
- - - [2.0] fn:error(error,description,error-object) -
-
- https://www.w3.org/TR/xpath-functions/#func-error
-
- W3C Documentation reference: #func-error -
-
-
- - - [2.0] fn:trace(value,label) -
-
- Used to debug queries
-
- W3C Documentation reference: #func-trace -
-
-
- +
-
-
- - - -
- - - [2.0] fn:nilled(node) -
-
- Returns a Boolean value indicating whether the argument node is nilled
-
- W3C Documentation reference: #func-nilled -
-
+
+ + +
- - [2.0] fn:namespace-uri-from-QName() + fn:function-arity(function(*))
-
- NONE
-
- W3C Documentation reference: #func-namespace-uri-from-QName -
+ Returns the arity (number of arguments) of the specified function
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
function(*)The function to obtain the arity for
xs:integerThe arity (number of arguments) of the specified function
+ Examples:
+ + + + + + + + + +
ExpressionResult
function-arity(fn:substring)Returns the arity of the substring function: 2 (since + substring accepts two required arguments: the input string and the + starting index)

+ W3C Documentation reference: function-arity
-
- - [2.0] fn:base-uri() + + fn:function-name(function(*))
-
- Returns the value of the base-uri property of the current or specified node
-
- W3C Documentation reference: #func-base-uri -
+ Returns the QName of the specified function
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
function(*)The function to obtain the QName for
xs:QName?The QName of the specified function, or an empty sequence if the + function is anonymous
+ Examples:
+ + + + + + + + + +
ExpressionResult
function-name(fn:substring)Returns the QName of the substring function: + QName("http://www.w3.org/2005/xpath-functions", "substring") +

+ W3C Documentation reference: function-name
-
- - [2.0] fn:base-uri(node) + + fn:function-lookup(xs:QName, xs:integer)
-
- Returns the value of the base-uri property of the current or specified node
-
- W3C Documentation reference: #func-base-uri -
+ Returns a function with the specified QName and arity if available, otherwise + returns an empty sequence
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:QNameFunction name as QName
xs:integerArity of the function
function(*)?A function with the specified QName and arity if available, otherwise an + empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
function-lookup(QName('http://www.w3.org/2005/xpath-functions', + 'substring'), 2)Returns the substring function with arity 2, if available

+ W3C Documentation reference: function-lookup
-
- - [2.0] fn:static-base-uri()
-
- Returns the value of the base-uri
- Examples:
- - - - - - - - - -
ExpressionResult
default-collation()http://www.w3.org/2005/xpath-functions/collation/codepoint

- W3C Documentation reference: #func-static-base-uri -
+ Returns the static base URI as an xs:anyURI, if available
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:anyURI?The static base URI, if available; otherwise, an empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
static-base-uri()Returns the static base URI as an xs:anyURI, if available, e.g., + 'https://www.example.com/base/'

+ W3C Documentation reference: static-base-uri
-
- - [2.0] fn:doc-available(URI) -
-
- Returns true if the doc() function returns a document node, otherwise it returns - false
-
- W3C Documentation reference: #func-doc-available -
-
-
- - [2.0] fn:resolve-QName() -
-
- NONE
-
- W3C Documentation reference: #func-resolve-QName -
-
-
- - - [2.0] fn:node-name(node) -
-
- Returns the node-name of the argument node
-
- W3C Documentation reference: #func-node-name -
-
-
- - - [2.0] fn:default-collation()
-
- Returns the value of the default collation
-
- W3C Documentation reference: #func-default-collation -
+ Returns the default collation URI as an xs:string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:stringThe default collation URI as a string
+ Examples:
+ + + + + + + + + +
ExpressionResult
default-collation()Returns the default collation URI as an xs:string, e.g., + 'http://www.w3.org/2005/xpath-functions/collation/codepoint'

+ W3C Documentation reference: default-collation
-
- - [2.0] fn:idref((string,string,...),node) + + fn:serialize(item()?, item()?)
-
- Returns a sequence of element or attribute nodes that have an IDREF value equal to - the value of one or more of the values specified in the string argument
-
- W3C Documentation reference: #func-idref -
+ Serializes an XML node, producing a string representation of the node
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()?An XML node to serialize
item()?Serialization options as a map, with key-value pairs defining the + serialization parameters (optional)
xs:string?A string representation of the serialized XML node or an empty sequence + if the input is an empty sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:serialize(<item>Item 1</item>)Returns '<item>Item 1</item>'
fn:serialize(<item>Item 1</item>, map{'method': 'xml', 'indent': + 'yes'})Returns an indented XML string representation of the input node

+ W3C Documentation reference: serialize
-
- - [2.0] fn:document-uri(node) + + fn:parse-xml-fragment(xs:string?)
-
- Returns the value of the document-uri property for the specified node
-
- W3C Documentation reference: #func-document-uri -
+ Parses a string containing an XML fragment and returns a corresponding document + node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?A string containing an XML fragment
document-node(element(*))?A document node containing the parsed XML fragment or an empty sequence + if the input is an empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:parse-xml-fragment('<item>Item 1</item><item>Item + 2</item>')Returns a document node containing the parsed XML fragment

+ W3C Documentation reference: parse-xml-fragment
-
- - [2.0] fn:local-name-from-QName() + + fn:parse-xml(xs:string?)
-
- NONE
-
- W3C Documentation reference: #func-local-name-from-QName -
+ Parses a string containing an XML document and returns a corresponding document + node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?A string containing an XML document
document-node(element(*))?A document node containing the parsed XML content or an empty sequence + if the input is an empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:parse-xml('<root><item>Item 1</item></root>')Returns a document node containing the parsed XML content

+ W3C Documentation reference: parse-xml
-
- - [2.0] fn:in-scope-prefixes() -
-
- NONE
-
- W3C Documentation reference: #func-in-scope-prefixes -
-
-
- - [2.0] fn:namespace-uri-for-prefix() -
-
- NONE
-
- W3C Documentation reference: #func-namespace-uri-for-prefix -
-
-
- - - [2.0] fn:QName() -
-
- NONE
-
- W3C Documentation reference: #func-QName -
-
-
- - - [2.0] fn:root() fn:root(node) -
-
- Returns the root of the tree to which the current node or the specified belongs. - This will usually be a document node
-
- W3C Documentation reference: #func-root -
-
-
- - - [2.0] fn:doc(URI) -
-
- NONE
-
- W3C Documentation reference: #func-doc -
-
-
- - - [2.0] fn:resolve-uri(relative,base) -
-
- NONE
-
- W3C Documentation reference: #func-resolve-uri -
-
-
- - - [3.0] fn:available-environment-variables()
-
- Returns a list of environment variable names
-
- W3C Documentation reference: #func-available-environment-variables -
+ Retrieves a sequence of the names of all available environment variables
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneNo argument is required
xs:string*A sequence of the names of all available environment variables
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:available-environment-variables()Returns a sequence of the names of all available environment variables +

+ W3C Documentation reference: available-environment-variables
-
- - [3.0] fn:doc-available(uri) + + fn:environment-variable(xs:string)
-
- The function returns true the function call fn:doc(uri) would return a document node -
-
- W3C Documentation reference: #func-doc-available -
+ Retrieves the value of an environment variable
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:stringThe name of the environment variable
xs:string?The value of the environment variable, or an empty sequence if the + variable is not set
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:environment-variable("PATH")Returns the value of the PATH environment variable, or an empty sequence + if the variable is not set

+ W3C Documentation reference: environment-variable
-
- - [3.0] fn:element-with-id() + + fn:uri-collection(xs:string?)
-
- https://www.w3.org/TR/xpath-functions-31/#func-element-with-id
-
- W3C Documentation reference: #func-element-with-id -
+ Returns a sequence of URIs in a collection identified by a URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the collection of URIs
xs:anyURI*A sequence of URIs in the collection
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:uri-collection("http://www.example.com/collection/")Returns a sequence of URIs in the collection identified by the specified + URI +
fn:uri-collection()Returns a sequence of URIs in the default collection, if one is defined +

+ W3C Documentation reference: uri-collection
-
- - [3.0] fn:encode-for-uri(uri-part) + fn:doc-available(xs:string?)
-
- Encodes reserved characters in a string that is intended to be used in the path - segment of a URI.
-
- W3C Documentation reference: #func-encode-for-uri -
+ Tests whether an XML document is available at a given URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI of the XML document to be tested
xs:booleanTrue if the XML document is available, otherwise false
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:doc-available("http://www.example.com/books.xml")Returns true if the XML document located at the specified URI is + available, otherwise false
fn:doc-available("")Returns true if the XML document containing the context item is + available, otherwise false

+ W3C Documentation reference: doc-available
-
- - [3.0] fn:environment-variable(name) + + fn:doc(xs:string?)
-
- Returns the value of a system environment variable, if it exists
-
- W3C Documentation reference: #func-environment-variable -
+ Loads an XML document from a URI and returns the document node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI of the XML document to be loaded
document-node()?The document node of the loaded XML document
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:doc("http://www.example.com/books.xml")Loads the XML document located at the specified URI and returns its + document node
fn:doc("")Returns the document node of the XML document containing the context + item

+ W3C Documentation reference: doc
-
- - [3.0] fn:escape-html-uri(uri) + + fn:generate-id(node()?)
-
- Escapes a URI in the same way that HTML user agents handle attribute values expected - to contain URIs
-
- W3C Documentation reference: #func-escape-html-uri -
+ Returns a unique identifier for the specified node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
node()?Input node for which the unique identifier is to be generated
xs:stringUnique identifier for the specified node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:generate-id(/bookstore/book[1])A unique identifier for the first <book> element in the + <bookstore>
fn:generate-id(.)A unique identifier for the context node

+ W3C Documentation reference: generate-id
-
- - [3.0] fn:iri-to-uri(iri) + + fn:idref(xs:string*)
-
- Converts a string containing an IRI into a URI
-
- W3C Documentation reference: #func-iri-to-uri -
+ Returns a sequence of nodes that are referenced by the specified IDREF attribute + values
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*Input sequence of IDREF attribute values
node()*Sequence of nodes referenced by the specified IDREF attribute values +
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:idref("reference42")Nodes referenced by the IDREF attribute value "reference42"
fn:idref(("ref1", "ref2", "ref3"))Nodes referenced by the IDREF attribute values "ref1", "ref2", and + "ref3"

+ W3C Documentation reference: idref
-
+ fn:id(xs:string*) +
+ Returns a sequence of elements with the specified ID attribute values
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*Input sequence of ID attribute values
element()*Sequence of elements with the specified ID attribute values
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:id("item42")Element with the ID attribute value "item42"
fn:id(("item1", "item2", "item3"))Elements with the ID attribute values "item1", "item2", and "item3"

+ W3C Documentation reference: id +
+ + + fn:lang(xs:string, node()?) +
+ Returns true if the language of the specified node or its nearest ancestor matches + the given language code
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:stringLanguage code to test
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:lang("en", /book/title)true
fn:lang("fr", /book/title)false

+ W3C Documentation reference: lang +
+ + + + fn:in-scope-prefixes(element()) +
+ Returns a sequence of strings representing the prefixes of the in-scope namespaces + for the specified element
+ Arguments and return type: + + + + + + + + + +
TypeDescription
element()Element node
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:in-scope-prefixes(/*)("xml", "x")

+ W3C Documentation reference: in-scope-prefixes +
+ + + fn:namespace-uri-for-prefix(xs:string?, element()) +
+ Returns the namespace URI associated with the given prefix, using the in-scope + namespaces for the specified element
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Prefix
element()Element node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:namespace-uri-for-prefix('x', /*)"http://www.example.com/ns"
fn:namespace-uri-for-prefix('', /*)""

+ W3C Documentation reference: namespace-uri-for-prefix +
+ + + fn:namespace-uri-from-QName(xs:QName?) +
+ Returns the namespace URI of the given QName value, or an empty sequence if there's + no namespace URI
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:QName?QName value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:namespace-uri-from-QName(fn:QName('http://www.example.com/ns', + 'x:local'))"http://www.example.com/ns"
fn:namespace-uri-from-QName(fn:QName('', 'local'))""

+ W3C Documentation reference: namespace-uri-from-QName +
+ + + fn:local-name-from-QName(xs:QName?) +
+ Returns the local name of the given QName value, or an empty sequence if there's no + local name
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:QName?QName value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:local-name-from-QName(fn:QName('http://www.example.com/ns', + 'x:local'))"local"
fn:local-name-from-QName(fn:QName('', 'local'))"local"

+ W3C Documentation reference: local-name-from-QName +
+ + + fn:prefix-from-QName(xs:QName?) +
+ Returns the prefix of the given QName value, or an empty sequence if there's no + prefix
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:QName?QName value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:prefix-from-QName(fn:QName('http://www.example.com/ns', 'x:local')) + "x"
fn:prefix-from-QName(fn:QName('', 'local'))()

+ W3C Documentation reference: prefix-from-QName +
+ + + fn:QName(xs:string?, xs:string) +
+ Constructs an xs:QName value from a namespace URI and a lexical QName
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Namespace URI
xs:stringLexical QName
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:QName('http://www.example.com/ns', 'x:local')QName("http://www.example.com/ns", "x:local")
fn:QName('', 'local')QName("", "local")

+ W3C Documentation reference: QName +
+ + + fn:resolve-QName(xs:string?, element()) +
+ Resolves a QName by expanding a prefix using the in-scope namespaces of a given + element
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?QName to resolve
element()Element with in-scope namespaces
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:resolve-QName('x:local', $element)QName("http://www.example.com/ns", "local")
fn:resolve-QName('local', $element)QName("", "local")

+ W3C Documentation reference: Resolve-QName +
+ + + + fn:nilled(node) +
+ Returns a Boolean value indicating whether the argument node is nilled
+
+ W3C Documentation reference: #func-nilled + +
+ + + + + +
-
- - -
- - - -
- - [3.0] fn:for-each(sequence*, function) -
-
- Applies function item to every element in sequence
-
- W3C Documentation reference: #func-for-each -
-
+
+ + +
- - [3.0] fn:for-each-pair(sequence*, sequence*, function) + fn:for-each-pair(item()*, item()*, function(item(), item()))
-
- Applies the function to consecutive pairs of elements taken from sequences
-
- W3C Documentation reference: #func-for-each-pair -
+ Applies a processing function to pairs of items from two input sequences in a + pairwise fashion, resulting in a sequence of the same length as the shorter input + sequence
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The first input sequence of items
item()*The second input sequence of items
function(item(), item())The processing function used to process pairs of items from the input + sequences
item()*The resulting sequence after applying the processing function to pairs + of items
+ Examples:
+ + + + + + + + + +
ExpressionResult
for-each-pair((1, 2, 3), ("a", "b"), function($item1, $item2) { + concat($item1, $item2) })Returns a sequence with the concatenated pairs of items: + ("1a", "2b") +

+ W3C Documentation reference: for-each-pair
-
- - [3.0] fn:fold-left(sequence*, baseValue, function) -
-
- Applies function item to every element in sequence, accumulating value
-
- W3C Documentation reference: #func-fold-left -
-
-
- - [3.0] fn:fold-right() -
-
- Applies function item to every element in sequence, accumulating value
-
- W3C Documentation reference: #func-fold-right -
-
-
- - [3.0] fn:filter(sequence*, function) + + fn:filter(item()*, function(item())
-
- Returns those items from the sequence for which the supplied function returns true
-
- W3C Documentation reference: #func-filter -
+ Filters a sequence of items based on a given predicate function
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
function(item())The predicate function used to filter the items
item()*The resulting sequence after applying the predicate function
+ Examples:
+ + + + + + + + + +
ExpressionResult
filter((1, 2, 3, 4), function($x) { $x mod 2 = 0 })Returns a new sequence containing only the even numbers from the input + sequence: (2, 4)

+ W3C Documentation reference: filter
-
+ + + fn:for-each(item()*, function(item())) +
+ Applies a specified function to each item in a sequence, returning a new + sequence
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
function(item())The function to apply to each item in the sequence
item()*The new sequence created by applying the function to each item in the + input sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
for-each((1, 2, 3, 4), function($x) { $x * 2 })Returns a new sequence with the result of doubling each number in the + input sequence: (2, 4, 6, 8)

+ W3C Documentation reference: for-each +
+ +
-
+ + +
+ + + +
+ fn:apply(function(item()*), array(*)) +
+ Applies a function to a sequence of arguments
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
function(item()*) as item()*The function to be applied
SequenceSequence of arguments to pass to the function
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:apply(fn:concat#2, ('Hello', ' World'))'Hello World'
fn:apply(fn:substring#2, ('Hello World', 7))'World'

+ W3C Documentation reference: Apply +
+ + + fn:outermost(node()*) +
+ Returns the outermost nodes of the input sequence that are not ancestors of any other + node in the input sequence
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()*Sequence of nodes
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:outermost(//chapter)Sequence of outermost chapter nodes
fn:outermost(/book//*)Sequence of outermost nodes in the book

+ W3C Documentation reference: outermost +
+ + + fn:innermost(node()*) +
+ Returns the innermost nodes of the input sequence that are not descendants of any other + node in the input sequence
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()*Sequence of nodes
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:innermost(//chapter)Sequence of innermost chapter nodes
fn:innermost(/book//*)Sequence of innermost nodes in the book

+ W3C Documentation reference: innermost +
+ + + fn:has-children(node()?) +
+ Returns true if the specified node has one or more children, otherwise returns false
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:has-children(/book/chapter[1])true
fn:has-children(/book/chapter[1]/title)false

+ W3C Documentation reference: has-children +
+ + + fn:path(node()?) +
+ Returns a string that represents the path of the specified node within the XML + document
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:path(/book/chapter[1])/book/chapter[1]
fn:path(/book/chapter[2]/title)/book/chapter[2]/title

+ W3C Documentation reference: path +
+ + + fn:root(node()?) +
+ Returns the root node of the tree that contains the specified node
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:root(/book/chapter)<book> element (root node)
fn:root(/book/chapter[1])<book> element (root node)

+ W3C Documentation reference: root +
+ + + fn:namespace-uri(node()?) +
+ Returns the namespace URI of the specified node
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:namespace-uri(/example:root)"http://www.example.com/ns"
fn:namespace-uri(/a/b)""

+ W3C Documentation reference: namespace-uri +
+ + + fn:local-name(node()?) +
+ Returns the local part of the name of the specified node
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:local-name(/a/b)"b"
fn:local-name(/example:root)"root"

+ W3C Documentation reference: local-name +
+ + fn:name(node()?) +
+ Returns the expanded QName of the specified node as a string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:name(/a/b)"b"
fn:name(/example:root)"example:root"

+ W3C Documentation reference: name +
+ + + + fn:document-uri(node?) +
+ Returns the document URI of the given node or the context item
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node?Returns the document URI of the specified node or the context item (if no + argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:document-uri(/library/fiction:book[1])http://example.com/library.xml (assuming the document URI of the first + fiction:book element is "http://example.com/library.xml")
fn:document-uri(/library)http://example.com/library.xml (assuming the document URI of the library + element is "http://example.com/library.xml")

+ W3C Documentation reference: Document-URI +
+ + + fn:base-uri(node?) +
+ Returns the base URI of the node or the context item
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node?Returns the base URI of the specified node or the context item (if no + argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:base-uri(/library/fiction:book[1])http://example.com/library.xml (assuming the base URI of the first + fiction:book element is "http://example.com/library.xml")
fn:base-uri(/library)http://example.com/library.xml (assuming the base URI of the library element + is "http://example.com/library.xml")

+ W3C Documentation reference: Base-URI +
+ + + fn:node-name(node?) +
+ + Returns the name of a node as an xs:QName
+ Arguments and return type: + + + + + + + + + +
TypeDescription
node?Returns the name of the specified node or the context item if the argument + is omitted
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:node-name(/library/*[1])fiction:book
fn:node-name(/library/fiction:book[1]/title)title

+ W3C Documentation reference: Node-Name +
+ +
+
+
+ + + +
+ + fn:not(item()*) +
+ Returns the negation of the effective boolean value of the argument
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item()*Argument whose effective boolean value is to be negated
+ Examples:
+ + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
fn:not(1)false
fn:not(0)true
fn:not('')true
fn:not('true')false

+ W3C Documentation reference: Not +
+ + + fn:false() +
+ Returns the boolean value false
+ Arguments and return type: + + + + + + + + + +
TypeDescription
NoneReturns the boolean value false
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:false()false
//item[fn:false()]Returns an empty node-set

+ W3C Documentation reference: False +
+ + + fn:true() +
+ Returns the boolean value true
+ Arguments and return type: + + + + + + + + + +
TypeDescription
NoneReturns the boolean value true
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:true()true
//item[fn:true()]Returns all <item> elements

+ W3C Documentation reference: True +
+ + + fn:boolean(item()*) +
+ Converts the argument to a boolean value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item()*Argument to be converted to a boolean value
+ Examples:
+ + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
fn:boolean(1)true
fn:boolean(0)false
fn:boolean('')false
fn:boolean('true')true

+ W3C Documentation reference: Boolean +
+ + +
+
+
+ + + +
+ + fn:unparsed-text-available(xs:string?, xs:string?) +
+ Determines if an unparsed text resource identified by a URI can be read using the given + encoding
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the unparsed text resource
xs:string?The encoding to be used for reading the resource
xs:booleanIndicates if the resource can be read using the given encoding
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:unparsed-text-available("http://www.example.com/text.txt", "UTF-8")Returns true if the text resource identified by the specified URI can be + read using the specified encoding, otherwise false

+ W3C Documentation reference: unparsed-text-available +
+ + + fn:unparsed-text-lines(xs:string?, xs:string?) +
+ Returns the contents of an unparsed text resource identified by a URI, split into + lines
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the unparsed text resource
xs:string?The encoding to be used for reading the resource
xs:string*The lines of the unparsed text resource
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:unparsed-text-lines("http://www.example.com/text.txt", "UTF-8")Returns the lines of the text resource identified by the specified URI, + using the specified encoding

+ W3C Documentation reference: unparsed-text-lines +
+ + + fn:unparsed-text(xs:string?, xs:string?) +
+ Returns the contents of an unparsed text resource identified by a URI
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the unparsed text resource
xs:string?The encoding to be used for reading the resource
xs:string?The contents of the unparsed text resource
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:unparsed-text("http://www.example.com/text.txt", "UTF-8")Returns the contents of the text resource identified by the specified URI, + using the specified encoding

+ W3C Documentation reference: unparsed-text +
+ + + fn:escape-html-uri(xs:string?) +
+ Escapes special characters in a URI to be used in HTML
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?URI to be escaped for use in HTML
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:escape-html-uri('https://example.com/search?q=test&lang=en')https://example.com/search?q=test&lang=en
fn:escape-html-uri('https://example.com/page?id=1§ion=2')https://example.com/page?id=1&section=2

+ W3C Documentation reference: Escape-HTML-URI +
+ + + fn:iri-to-uri(xs:string?) +
+ Converts an IRI to a URI by escaping non-ASCII characters
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?IRI to be converted to a URI
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:iri-to-uri('https://example.com/ümlaut')https://example.com/%C3%BCmlaut
fn:iri-to-uri('https://example.com/日本語')https://example.com/%E6%97%A5%E6%9C%AC%E8%AA%9E

+ W3C Documentation reference: IRI-to-URI +
+ + + fn:encode-for-uri(xs:string?) +
+ Encodes a string for use in a URI by escaping special characters
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?String to be encoded for use in a URI
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:encode-for-uri('hello world')hello%20world
fn:encode-for-uri('example?query=value¶m=value2')example%3Fquery%3Dvalue%26param%3Dvalue2

+ W3C Documentation reference: Encode-for-URI +
+ + + fn:resolve-uri(xs:string?, xs:string?) +
+ Resolves a relative URI using a base URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Relative URI to resolve
xs:string?Base URI to use for resolving (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:resolve-uri('example.html', 'https://www.example.com/folder/')https://www.example.com/folder/example.html
fn:resolve-uri('../images/pic.jpg', + 'https://www.example.com/folder/page.html')https://www.example.com/images/pic.jpg

+ W3C Documentation reference: Resolve-URI +
+ + + + fn:analyze-string(xs:string?, xs:string, xs:string?) +
+ Analyzes the input string and returns an XML fragment containing match and non-match + elements
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to analyze
xs:stringRegular expression pattern to match
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:analyze-string('red,green,blue', ',') + <fn:analyze-string-result><fn:non-match>red</fn:non-match><fn:match>, + <fn:non-match>green</fn:non-match><fn:match>, + <fn:non-match>blue</fn:non-match></fn:analyze-string-result> +

+ W3C Documentation reference: Analyze-String +
+ + + fn:tokenize(xs:string?, xs:string, xs:string?) +
+ Splits the input string into a sequence of substrings using the pattern as a delimiter +
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to tokenize
xs:stringRegular expression pattern to use as delimiter
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:tokenize('XPath 3.0, XQuery 3.0, XSLT 3.0', ',\\s*')('XPath 3.0', 'XQuery 3.0', 'XSLT 3.0')
fn:tokenize('apple,orange,banana', ',')('apple', 'orange', 'banana')

+ W3C Documentation reference: Tokenize +
+ + + fn:replace(xs:string?, xs:string, xs:string, xs:string?) +
+ Replaces occurrences of the pattern in the input string with the replacement string
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:stringRegular expression pattern to match
xs:stringReplacement string
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:replace('XPath 3.0 is great', '3.0', '3.1')'XPath 3.1 is great'
fn:replace('Hello, World!', 'World', 'XPath')'Hello, XPath!'

+ W3C Documentation reference: Replace +
+ + + fn:matches(xs:string?, xs:string, xs:string?) +
+ Returns true if the input string matches the regular expression pattern, otherwise false +
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:stringRegular expression pattern to match
xs:string?Flags to control the regular expression matching (optional)
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:matches('XPath 3.0', '\\d\\.\\d')true
fn:matches('Hello, World!', '[A-Z][a-z]*')true
fn:matches('example123', '\\d+', 'q')false

+ W3C Documentation reference: Matches +
+ + + fn:substring-after(xs:string?, xs:string?) +
+ Returns the part of the first string that follows the first occurrence of the second + string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:string?Substring to search for
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:substring-after('Hello, World!', ',')' World!'
fn:substring-after('XPath 3.0 is awesome!', '3.0')' is awesome!'

+ W3C Documentation reference: Substring-After +
+ + + fn:substring-before(xs:string?, xs:string?) +
+ Returns the part of the first string that precedes the first occurrence of the second + string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:string?Substring to search for
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:substring-before('Hello, World!', ',')'Hello'
fn:substring-before('XPath 3.0 is awesome!', '3.0')'XPath '

+ W3C Documentation reference: Substring-Before +
+ + + fn:ends-with(xs:string?, xs:string?) +
+ Returns true if the first string ends with the second string, otherwise false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to check
xs:string?Substring to check for at the end of the first string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:ends-with('Hello, World!', 'World!')true
fn:ends-with('Hello, World!', 'Hello')false
fn:ends-with('XPath 3.0', '3.0')true

+ W3C Documentation reference: Ends-With +
+ + + fn:starts-with(xs:string?, xs:string?) +
+ Returns true if the first string starts with the second string, otherwise false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to check
xs:string?Substring to check for at the beginning of the first string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:starts-with('Hello, World!', 'Hello')true
fn:starts-with('Hello, World!', 'World')false
fn:starts-with('XPath 3.0', 'XPath')true

+ W3C Documentation reference: Starts-With +
+ + + fn:contains(xs:string?, xs:string?) +
+ Returns true if the first string contains the second string, otherwise false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to search within
xs:string?Substring to search for
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:contains('Hello, World!', 'World')true
fn:contains('Hello, World!', 'world')false
fn:contains('XPath 3.0', '3.0')true

+ W3C Documentation reference: Contains +
+ + + fn:translate(xs:string?, xs:string, xs:string) +
+ Returns the input string with specified characters replaced
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to be translated
xs:stringMap string with characters to replace
xs:stringTranslate string with replacement characters
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:translate('apple', 'aeiou', '12345')'1ppl2'
fn:translate('Hello, World!', 'HW', 'hw')'hello, world!'

+ W3C Documentation reference: Translate +
+ + + fn:lower-case(xs:string?) +
+ Returns the input string with all characters converted to lowercase
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to convert to lowercase
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:lower-case('HELLO, WORLD!')'hello, world!'
fn:lower-case('XPath 3.0')'xpath 3.0'
fn:lower-case('BANANA')'banana'

+ W3C Documentation reference: Lower-Case +
+ + + fn:upper-case(xs:string?) +
+ Returns the input string with all characters converted to uppercase
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to convert to uppercase
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:upper-case('Hello, World!')'HELLO, WORLD!'
fn:upper-case('XPath 3.0')'XPATH 3.0'
fn:upper-case('banana')'BANANA'

+ W3C Documentation reference: Upper-Case +
+ + + fn:normalize-unicode(xs:string?, xs:string) +
+ Returns the input string with Unicode normalization applied
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input string to normalize
xs:stringNormalization form to apply (NFC, NFD, NFKC, NFKD)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:normalize-unicode('Café', 'NFC')'Café'
fn:normalize-unicode('Café', 'NFD')'Café'

+ W3C Documentation reference: Normalize-Unicode +
+ + + fn:normalize-space(xs:string?) +
+ Returns the input string with whitespace normalized
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to normalize whitespace
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:normalize-space(' Hello, World! ')'Hello, World!'
fn:normalize-space(' XPath 3.0 ')'XPath 3.0'
fn:normalize-space('\tbanana\t')'banana'

+ W3C Documentation reference: Normalize-Space +
+ + + fn:string-length(xs:string?) +
+ Returns the length of the input string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string to calculate length
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:string-length('Hello, World!')13
fn:string-length('XPath 3.0')8
fn:string-length('banana')6

+ W3C Documentation reference: String-Length +
+ + + fn:substring(xs:string?, xs:double) +
+ Returns a substring of the source string, starting from a specific location
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Input source string
xs:doubleStarting location to extract the substring
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:substring('Hello, World!', 1, 5)'Hello'
fn:substring('XPath 3.0', 7)'3.0'
fn:substring('banana', 2, 3)'ana'

+ W3C Documentation reference: Substring +
+ + fn:string-join(xs:string*, xs:string) +
+ Joins a sequence of strings with a specified separator, returning a single string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*Input sequence of strings to join
xs:stringSeparator string to insert between joined strings
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:string-join(('apple', 'banana', 'orange'), ', ')'apple, banana, orange'
fn:string-join(('XPath', '3.0', 'Functions'), ' - ')'XPath - 3.0 - Functions'
fn:string-join(('A', 'B', 'C'), '')'ABC'

+ W3C Documentation reference: String-Join +
+ + + fn:concat(xs:anyAtomicType?, xs:anyAtomicType?, ...) +
+ Concatenates two or more strings or atomic values, returning a single string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:anyAtomicType?Input strings or atomic values to concatenate
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:concat('Hello', ' ', 'World')'Hello World'
fn:concat('I have ', 3, ' apples')'I have 3 apples'
fn:concat('XPath ', '3.0')'XPath 3.0'

+ W3C Documentation reference: Concat +
+ + + fn:codepoint-equal(xs:string?, xs:string?) +
+ Compares two strings on a codepoint-by-codepoint basis and returns true if they are + equal, false otherwise
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?First string to compare
xs:string?Second string to compare
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:codepoint-equal('Hello', 'Hello')true
fn:codepoint-equal('Hello', 'hello')false
fn:codepoint-equal('apple', 'banana')false

+ W3C Documentation reference: Codepoint-Equal +
+ + + fn:compare(xs:string?, xs:string?) +
+ Compares two strings and returns -1, 0, or 1 if the first string is less than, equal to, + or greater than the second string, respectively
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?First string to compare
xs:string?Second string to compare
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:compare('apple', 'banana')-1
fn:compare('apple', 'apple')0
fn:compare('banana', 'apple')1

+ W3C Documentation reference: Compare +
+ + + fn:string-to-codepoints(xs:string?) +
+ Returns a sequence of Unicode code points for a given string
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?Input string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:string-to-codepoints('Hello')(72, 101, 108, 108, 111)
fn:string-to-codepoints('( ͡° ͜ʖ ͡°)')(40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41)
fn:string-to-codepoints('😊')(128522)

+ W3C Documentation reference: String-To-Codepoints +
+ + + fn:codepoints-to-string(xs:integer*) +
+ Constructs a string from a sequence of Unicode code points
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:integer*Sequence of Unicode code points
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:codepoints-to-string((72, 101, 108, 108, 111))Hello
codepoints-to-string((40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41)) + ( ͡° ͜ʖ ͡°)
fn:codepoints-to-string((128522))😊

+ W3C Documentation reference: Codepoints-To-String +
+ + + + fn:string(object) +
+ Returns the string representation of the object argument
+ Arguments and return type: + + + + + + + + + +
TypeDescription
stringThe object to convert to a string
Examples:
+ + + + + + + + + + + + + +
ExpressionResult
string((1<0))false
string(.11)0.11

+ W3C Documentation reference: String-Functions +
+ + +
+
+
+ + + +
+ + + fn:format-number(numeric?, xs:string, item()?) +
+ Returns a string that represents a formatted version of a number using a formatting + pattern and an optional + set of properties
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
numeric?The number to format
xs:stringThe formatting pattern
item()?Optional: the set of properties for formatting the number
xs:stringThe formatted number as a string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
format-number(12345.678, "#,##0.00")Returns the formatted number: "12,345.68"
format-number(12345.678, "#,##0")Returns the formatted number: "12,346"
format-number(12345.678, "0.000")Returns the formatted number: "12345.678"

+ W3C Documentation reference: format-number +
+ + + + fn:format-integer(xs:integer?, xs:string) +
+ Formats an integer value according to the supplied picture string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:integer?Integer value to be formatted
xs:stringPicture string defining the format
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:format-integer(12345, '0,0')12,345
fn:format-integer(-1234, '0,0')-1,234
fn:format-integer(1234, '00-00-00')01-23-45

+ W3C Documentation reference: Format-Integer +
+ + + fn:round-half-to-even(numeric?) +
+ Returns the closest integer to the given numeric value, rounding half-way cases to the + nearest even integer (also known as "bankers' rounding")
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the rounded value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + + + + + +
ExpressionResult
fn:round-half-to-even(3.5)4
fn:round-half-to-even(2.5)2
fn:round-half-to-even(-1.5)-2
fn:round-half-to-even(xs:decimal('1.25'), 1)1.2

+ W3C Documentation reference: Round-Half-To-Even +
+ + + fn:round(numeric?) +
+ Returns the closest integer to the given numeric value, rounding half-way cases away + from zero
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the rounded value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:round(3.14)3
fn:round(-4.7)-5
fn:round(xs:decimal('2.5'))3

+ W3C Documentation reference: Round +
+ + + fn:floor(numeric?) +
+ Returns the largest integer less than or equal to the given numeric value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the floor value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:floor(3.14)3
fn:floor(-4.7)-5
fn:floor(xs:decimal('2.5'))2

+ W3C Documentation reference: Floor +
+ + + + fn:ceiling(numeric?) +
+ Returns the smallest integer greater than or equal to the given numeric value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the ceiling value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:ceiling(3.14)4
fn:ceiling(-4.7)-4
fn:ceiling(xs:decimal('2.5'))3

+ W3C Documentation reference: Ceiling +
+ + + fn:abs(numeric?) +
+ Returns the absolute value of the given numeric value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
numeric?Numeric value for which the absolute value will be calculated
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:abs(-42)42
fn:abs(3.14)3.14
fn:abs(xs:decimal('-5.5'))5.5

+ W3C Documentation reference: Abs +
+ + fn:number(item?) +
+ Converts the given value to a number
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item?Returns the numeric value of the specified expression or the context item + (if no argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:number(/library/fiction:book[1]/@id)1 (if the first fiction:book element's id attribute is "1")
fn:number(/library/fiction:book[1]/price)19.99 (if the first fiction:book element's price element contains "19.99") +

+ W3C Documentation reference: Number +
+ + + + +
+
+
+ + + +
+ + fn:sort(item()*) +
+ Sorts an array of items based on their atomic values
+ Arguments and return type: + + + + + + + + + +
TypeDescription
ArrayThe array of items to be sorted
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:sort([10, 5, 20])[5, 10, 20]
fn:sort(['banana', 'apple', 'cherry'])['apple', 'banana', 'cherry']

+ W3C Documentation reference: Sort +
+ + + fn:fold-right(item()*, item()*, function(item(), item()*)) +
+ Applies a processing function cumulatively to the items of a sequence from right to + left, so as to reduce the sequence to a single value
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
item()*The initial value, also known as the zero value
function(item(), item()*)The processing function used to accumulate the items
item()*The resulting single value after applying the processing function
+ Examples:
+ + + + + + + + + +
ExpressionResult
fold-right((1, 2, 3, 4), 0, function($current, $accumulator) { $accumulator + - $current })Returns the result of subtracting each number in the input sequence from + right to left: -2

+ W3C Documentation reference: fold-right +
+ + + fn:fold-left(item()*, item()*, function(item()*, item())) +
+ Applies a processing function cumulatively to the items of a sequence from left to + right, so as to reduce the sequence to a single value
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
item()*The initial value, also known as the zero value
function(item()*, item())The processing function used to accumulate the items
item()*The resulting single value after applying the processing function
+ Examples:
+ + + + + + + + + +
ExpressionResult
fold-left((1, 2, 3, 4), 0, function($accumulator, $current) { $accumulator + + $current })Returns the sum of the numbers in the input sequence: 10

+ W3C Documentation reference: fold-left +
+ + + + + fn:last() +
+ Returns the position of the last item in the current context sequence
+ Arguments and return type: + + + + + + + + + +
TypeDescription
NoneReturns the position of the last item in the current context sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
/library/fiction:book[position() = last()]Returns the last fiction:book element in the library
/library/fiction:book[last()]Returns the last fiction:book element in the library

+ W3C Documentation reference: Last +
+ + fn:position() +
+ Returns the context position of the context item in the sequence currently being + processed
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:integerThe position of the context item in the sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
<items><item>Item 1</item><item>Item + 2</item></items>/item[position()=2]Returns '<item>Item 2</item>'
<items><item>Item 1</item><item>Item + 2</item></items>/item[position()=1]Returns '<item>Item 1</item>'

+ W3C Documentation reference: position +
+ + + fn:collection(xs:string?) +
+ Returns a sequence of document nodes obtained from the collection identified by the + argument URI, or the + default collection if no argument is supplied.
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI of the collection to retrieve (Optional)
document-node()*A sequence of document nodes obtained from the collection
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
collection()Returns the sequence of document nodes from the default collection
collection("http://example.com/collection")Returns the sequence of document nodes from the collection identified by the + specified URI
count(collection())Returns the number of document nodes in the default collection

+ W3C Documentation reference: collection +
+ + + fn:sum(xs:anyAtomicType*, xs:anyAtomicType?) +
+ Returns the sum of a sequence of numeric values
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of numeric values
xs:anyAtomicType?Value to return if the sequence is empty (optional)
xs:anyAtomicType?Sum of the input sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:sum((10, 20, 30, 40, 50))150
fn:sum((), 0)0

+ W3C Documentation reference: sum +
+ + + fn:min(xs:anyAtomicType*) +
+ Returns the minimum value of a sequence of atomic values, according to the ordering + rules for the value's + type
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*The input sequence of atomic values
xs:anyAtomicType?The minimum value of the input sequence, or the empty sequence if the input + sequence is empty +
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
min((5, 1, 9, 3))Returns the minimum value: 1
min(())Returns the empty sequence: ()
min(("apple", "banana", "cherry"))Returns the minimum value (alphabetical order): "apple"

+ W3C Documentation reference: min +
+ + + fn:max(xs:anyAtomicType*) +
+ Returns the maximum value of a sequence of atomic values, according to the ordering + rules for the value's + type
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*The input sequence of atomic values
xs:anyAtomicType?The maximum value of the input sequence, or the empty sequence if the input + sequence is empty +
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
max((5, 1, 9, 3))Returns the maximum value: 9
max(())Returns the empty sequence: ()
max(("apple", "banana", "cherry"))Returns the maximum value (alphabetical order): "cherry"

+ W3C Documentation reference: max +
+ + + + fn:avg(xs:anyAtomicType*) +
+ Computes the average of the numeric values in the input sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of numeric values
xs:anyAtomicType?Average of the numeric values in the input sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:avg((10, 20, 30, 40, 50))30
fn:avg((2.5, 3.5, 4.5))3.5
fn:avg(())empty sequence

+ W3C Documentation reference: avg +
+ + + fn:count(item()*) +
+ Returns the number of items in the input sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
xs:integerNumber of items in the input sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:count(('apple', 'banana', 'orange'))3
fn:count(())0
fn:count((1, 2, 3, 4, 5))5

+ W3C Documentation reference: count +
+ + + fn:exactly-one(item()*) +
+ Returns the single item in the input sequence or raises an error if the sequence is + empty or contains more than one item
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()Single item from the input sequence, otherwise an error is raised
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:exactly-one(('apple'))'apple'
fn:exactly-one(('apple', 'banana'))Error (more than one item)
fn:exactly-one(())Error (empty sequence)

+ W3C Documentation reference: exactly-one +
+ + + fn:one-or-more(item()*)+ +
+ Returns the input sequence if it contains one or more items, otherwise raises an + error
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()+Sequence containing one or more items, otherwise an error is raised
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:one-or-more(('apple', 'banana'))('apple', 'banana')
fn:one-or-more(('pear'))('pear')

+ W3C Documentation reference: one-or-more +
+ + + fn:zero-or-one(item()*) +
+ Returns the input sequence if it contains zero or one items, otherwise raises an + error
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()?Sequence containing zero or one item, otherwise an error is raised
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:zero-or-one(('apple'))('apple')
fn:zero-or-one(())()

+ W3C Documentation reference: zero-or-one +
+ + + fn:deep-equal(item()* , item()*) +
+ Returns true if the two input sequences are deep-equal, meaning that they have the same + structure and atomic values
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*First input sequence
item()*Second input sequence
xs:booleanTrue if the input sequences are deep-equal, otherwise false
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:deep-equal((1, 2, 3), (1, 2, 3))true
fn:deep-equal((1, 2, 3), (1, 2, 4))false

+ W3C Documentation reference: deep-equal +
+ + + fn:index-of(xs:anyAtomicType*, xs:anyAtomicType) +
+ Returns a sequence of integers indicating the positions of items in the input sequence + that are equal to the search item
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of atomic values
xs:anyAtomicTypeSearch item to find in the input sequence
xs:integer*Sequence of integers representing the positions of the search item in the + input sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:index-of((3, 1, 4, 1, 5, 9, 2, 2, 3), 1)(2, 4)
fn:index-of(('apple', 'banana', 'orange', 'apple', 'grape', 'orange'), + 'apple')(1, 4)

+ W3C Documentation reference: index-of +
+ + + fn:distinct-values(xs:anyAtomicType*) +
+ Returns a sequence of distinct atomic values from the input sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:anyAtomicType*Input sequence of atomic values
xs:anyAtomicType*Distinct sequence of atomic values
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:distinct-values((3, 1, 4, 1, 5, 9, 2, 2, 3))(3, 1, 4, 5, 9, 2)
fn:distinct-values(('apple', 'banana', 'orange', 'apple', 'grape', + 'orange'))('apple', 'banana', 'orange', 'grape')

+ W3C Documentation reference: distinct-values +
+ + + fn:unordered(item()*) +
+ Returns the items of a sequence in an implementation-dependent order
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()*Unordered sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:unordered((3, 1, 4, 1, 5, 9, 2))(1, 2, 3, 4, 5, 9, 1) (example result; actual order may vary)
fn:unordered(('apple', 'banana', 'orange', 'grape'))('banana', 'apple', 'orange', 'grape') (example result; actual order may + vary)

+ W3C Documentation reference: unordered +
+ + + fn:subsequence(item()*, xs:double, xs:double) +
+ Returns a subsequence of a given sequence starting at a specified position with a + specified length
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
xs:doubleStarting position
xs:doubleLength of subsequence
item()*Subsequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:subsequence((1, 2, 3, 4, 5), 2, 3)(2, 3, 4)
fn:subsequence(('apple', 'banana', 'orange', 'grape'), 1, 2)('apple', 'banana')
fn:subsequence(('red', 'blue', 'green', 'yellow'), 3)('green', 'yellow')

+ W3C Documentation reference: subsequence +
+ + + fn:reverse(item()*) +
+ Reverses the order of items in a sequence
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Input sequence
item()*Reversed sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:reverse((1, 2, 3, 4))(4, 3, 2, 1)
fn:reverse(('apple', 'banana', 'orange'))('orange', 'banana', 'apple')
fn:reverse(('red', 'blue', 'green'))('green', 'blue', 'red')

+ W3C Documentation reference: reverse +
+ + + fn:remove(item()*, xs:integer) +
+ Removes an item from a sequence at the specified position
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*Target sequence
xs:integerPosition of the item to remove
item()*New sequence with the item removed
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:remove((1, 2, 3, 4), 2)(1, 3, 4)
fn:remove(('apple', 'banana', 'orange'), 3)('apple', 'banana')
fn:remove((10, 20, 30), 1)(20, 30)

+ W3C Documentation reference: remove +
+ + + fn:insert-before(item()*, xs:integer, item()*) +
+ Inserts items from the specified sequence into another sequence at a given position
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*Target sequence
xs:integerPosition at which to insert the items
item()*Sequence of items to insert
item()*New sequence with items inserted
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:insert-before((1, 3, 4), 2, (2))(1, 2, 3, 4)
fn:insert-before(('apple', 'orange'), 1, ('banana'))('banana', 'apple', 'orange')
fn:insert-before((10, 20, 30), 4, (40))(10, 20, 30, 40)

+ W3C Documentation reference: insert-before +
+ + + fn:tail(item()*) +
+ Returns all items of the input sequence except the first one, or an empty sequence if + the input is empty or contains only one item
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
item()*All items except the first one, or an empty sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:tail((1, 2, 3))(2, 3)
fn:tail((1))()
fn:tail(/books/book/author)All authors in the "books" element except the first one

+ W3C Documentation reference: tail +
+ + + fn:head(item()*) +
+ Returns the first item of the input sequence, or an empty sequence if the input is + empty
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
item()?The first item of the sequence, or an empty sequence
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:head((1, 2, 3))1
fn:head(())()
fn:head(/books/book[1]/author)The first author of the first book in the "books" element

+ W3C Documentation reference: head +
+ + + fn:exists(item()*) +
+ Returns true if the input sequence is not empty, otherwise returns false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
xs:booleanResult of the test (true or false)
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:exists((1, 2, 3))true
fn:exists(())false
fn:exists(//chapter[5])true if there are at least 5 chapters, otherwise false

+ W3C Documentation reference: exists +
+ + + fn:empty(item()*) +
+ Returns true if the input sequence is empty, otherwise returns false
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Sequence of items
xs:booleanResult of the test (true or false)
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
fn:empty((1, 2, 3))false
fn:empty(())true
fn:empty(//chapter[100])true if there are less than 100 chapters, otherwise false

+ W3C Documentation reference: empty +
+ + + + + fn:data(item*) +
+ Returns the simple value of an item or a sequence of items
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item?Returns the simple value of the specified item or the context item (if no + argument is provided)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:data(/library/fiction:book[1]/title)The Catcher in the Rye
fn:data(/library/fiction:book[2]/author)Harper Lee

+ W3C Documentation reference: Data +
+ + +
+
+
+ + + +
+ + + + fn:implicit-timezone() +
+ Returns the implicit timezone as an xs:dayTimeDuration
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:dayTimeDurationThe implicit timezone as a dayTimeDuration
+ Examples:
+ + + + + + + + + +
ExpressionResult
implicit-timezone()Returns the implicit timezone as an xs:dayTimeDuration, e.g., '-PT7H' +

+ W3C Documentation reference: implicit-timezone +
+ + + fn:current-time() +
+ Returns the current time with timezone
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:timeThe current time with timezone
+ Examples:
+ + + + + + + + + +
ExpressionResult
current-time()Returns the current time with timezone, e.g., '13:45:30.123-07:00'

+ W3C Documentation reference: current-time +
+ + + fn:current-date() +
+ Returns the current date with timezone
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:dateThe current date with timezone
+ Examples:
+ + + + + + + + + +
ExpressionResult
current-date()Returns the current date with timezone, e.g., '2023-03-29-07:00'

+ W3C Documentation reference: current-date +
+ + + fn:current-dateTime() +
+ Returns the current date and time with timezone
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:dateTimeThe current date and time with timezone
+ Examples:
+ + + + + + + + + +
ExpressionResult
current-dateTime()Returns the current date and time with timezone, e.g., + '2023-03-29T12:34:56.789-07:00'

+ W3C Documentation reference: current-dateTime +
+ + + fn:format-time(xs:time?, xs:string, xs:string?, xs:string?, xs:string?) +
+ Formats a time value according to a formatting picture string, with optional language, + calendar, and + country parameters.
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:time?The time value to be formatted (Optional)
xs:stringThe formatting picture string
xs:string?The language for formatting (Optional)
xs:string?The calendar for formatting (Optional)
xs:string?The country for formatting (Optional)
xs:stringThe formatted time value as a string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
format-time(xs:time("14:30:00"), "[H]:[m]")"14:30"
format-time(xs:time("14:30:00"), "[H]:[m]:[s]")"14:30:00"
format-time(xs:time("14:30:00.456"), "[H]:[m]:[s].[f]")"14:30:00.456"

+ W3C Documentation reference: format-time +
+ + + + fn:format-date(xs:date?, xs:string, xs:string?, xs:string?, xs:string?) +
+ Formats a date value using the provided picture string and optional language, + calendar, and country settings
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:date?Date value
xs:stringPicture string
xs:string?Language
xs:string?Calendar
xs:string?Country
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:format-date(xs:date('2023-04-01'), '[Y0001]-[M01]-[D01]')2023-04-01
fn:format-date(xs:date('2023-04-01'), '[MNn,*-3] [D], [Y]')Apr 1, 2023

+ W3C Documentation reference: Format-Date +
+ + + fn:format-dateTime(xs:dateTime?, xs:string, xs:string?, xs:string?, xs:string?) +
+ Formats a dateTime value according to a formatting picture string, with optional + language, calendar, and + country parameters.
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
xs:dateTime?The dateTime value to be formatted (Optional)
xs:stringThe formatting picture string
xs:string?The language for formatting (Optional)
xs:string?The calendar for formatting (Optional)
xs:string?The country for formatting (Optional)
xs:stringThe formatted dateTime value as a string
+ Examples:
+ + + + + + + + + + + + + + + + + +
ExpressionResult
format-dateTime(xs:dateTime("2023-04-12T14:30:00"), "[Y]-[M]-[D]T[H]:[m]") + "2023-04-12T14:30"
format-dateTime(xs:dateTime("2023-04-12T14:30:00"), "[FNn, Nn] [D] [MNn] + [Y]")"Wednesday, 12 April 2023"
format-dateTime(xs:dateTime("2023-04-12T14:30:00.123"), + "[Y]-[M]-[D]T[H]:[m]:[s].[f]")"2023-04-12T14:30:00.123"

+ W3C Documentation reference: format-dateTime +
+ + + + fn:adjust-time-to-timezone(xs:time?, xs:dayTimeDuration?) +
+ Adjusts the timezone of a time value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:time?Time value
xs:dayTimeDuration?Timezone adjustment
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:adjust-time-to-timezone(xs:time('10:00:00-07:00'), + xs:dayTimeDuration('PT2H'))12:00:00-05:00
fn:adjust-time-to-timezone(xs:time('10:00:00Z'), + xs:dayTimeDuration('-PT3H'))07:00:00-03:00

+ W3C Documentation reference: Adjust-Time-To-Timezone +
+ + + + + fn:adjust-date-to-timezone(xs:date?, xs:dayTimeDuration?) +
+ Adjusts the timezone of a date value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:date?Date value
xs:dayTimeDuration?Timezone adjustment
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:adjust-date-to-timezone(xs:date('2023-01-01-07:00'), + xs:dayTimeDuration('PT2H'))2023-01-01-05:00
fn:adjust-date-to-timezone(xs:date('2023-01-01Z'), + xs:dayTimeDuration('-PT3H'))2022-12-31-03:00

+ W3C Documentation reference: Adjust-Date-To-Timezone +
+ + + fn:adjust-dateTime-to-timezone(xs:dateTime?, xs:dayTimeDuration?) +
+ Adjusts the timezone of a dateTime value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
xs:dayTimeDuration?Timezone adjustment
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:adjust-dateTime-to-timezone(xs:dateTime('2023-01-01T12:00:00-07:00'), + xs:dayTimeDuration('PT2H'))2023-01-01T17:00:00-05:00
fn:adjust-dateTime-to-timezone(xs:dateTime('2023-01-01T12:00:00Z'), + xs:dayTimeDuration('-PT3H'))2023-01-01T09:00:00-03:00

+ W3C Documentation reference: Adjust-DateTime-To-Timezone +
+ + + fn:timezone-from-time(xs:time?) +
+ Extracts the timezone component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:timezone-from-time(xs:time('12:00:00-07:00'))-PT7H
fn:timezone-from-time(xs:time('14:30:00+02:30'))PT2H30M

+ W3C Documentation reference: Timezone-From-Time +
+ + + fn:seconds-from-time(xs:time?) +
+ Extracts the seconds component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:seconds-from-time(xs:time('21:45:30.5'))30.5
fn:seconds-from-time(xs:time('04:15:12.1'))12.1

+ W3C Documentation reference: Seconds-From-Time +
+ + + fn:minutes-from-time(xs:time?) +
+ Extracts the minutes component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:minutes-from-time(xs:time('21:45:30'))45
fn:minutes-from-time(xs:time('04:15:12'))15

+ W3C Documentation reference: Minutes-From-Time +
+ + + fn:hours-from-time(xs:time?) +
+ Extracts the hours component from an xs:time value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:hours-from-time(xs:time('21:45:30'))21
fn:hours-from-time(xs:time('04:15:12'))4

+ W3C Documentation reference: Hours-From-Time +
+ + + fn:timezone-from-date(xs:date?) +
+ Extracts the timezone component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:timezone-from-date(xs:date('2023-03-29+02:00'))PT2H
fn:timezone-from-date(xs:date('1980-12-15-05:00'))-PT5H

+ W3C Documentation reference: Timezone-From-Date +
+ + + fn:day-from-date(xs:date?) +
+ Extracts the day component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:day-from-date(xs:date('2023-03-29'))29
fn:day-from-date(xs:date('1980-12-15'))15

+ W3C Documentation reference: Day-From-Date +
+ + + fn:month-from-date(xs:date?) +
+ Extracts the month component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:month-from-date(xs:date('2023-03-29'))3
fn:month-from-date(xs:date('1980-12-15'))12

+ W3C Documentation reference: Month-From-Date +
+ + + fn:year-from-date(xs:date?) +
+ Extracts the year component from an xs:date value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:date?Date value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:year-from-date(xs:date('2023-03-29'))2023
fn:year-from-date(xs:date('1980-12-15'))1980

+ W3C Documentation reference: Year-From-Date +
+ + + fn:timezone-from-dateTime(xs:dateTime?) +
+ Extracts the timezone component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:timezone-from-dateTime(xs:dateTime('2023-03-29T12:30:45-07:00'))-PT7H
fn:timezone-from-dateTime(xs:dateTime('2023-12-15T18:45:30+03:30'))PT3H30M

+ W3C Documentation reference: Timezone-From-DateTime +
+ + + fn:seconds-from-dateTime(xs:dateTime?) +
+ Extracts the seconds component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:seconds-from-dateTime(xs:dateTime('2023-03-29T12:30:45'))45
fn:seconds-from-dateTime(xs:dateTime('2023-12-15T18:45:30.5-08:00')) + 30.5

+ W3C Documentation reference: Seconds-From-DateTime +
+ + + fn:minutes-from-dateTime(xs:dateTime?) +
+ Extracts the minutes component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:minutes-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))30
fn:minutes-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))45

+ W3C Documentation reference: Minutes-From-DateTime +
+ + + fn:hours-from-dateTime(xs:dateTime?) +
+ Extracts the hours component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:hours-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))12
fn:hours-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))18

+ W3C Documentation reference: Hours-From-DateTime +
+ + + fn:day-from-dateTime(xs:dateTime?) +
+ Extracts the day component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:day-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))29
fn:day-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))15

+ W3C Documentation reference: Day-From-DateTime +
+ + + fn:month-from-dateTime(xs:dateTime?) +
+ Extracts the month component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:month-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))3
fn:month-from-dateTime(xs:dateTime('2023-12-15T18:45:00-08:00'))12

+ W3C Documentation reference: Month-From-DateTime +
+ + + fn:year-from-dateTime(xs:dateTime?) +
+ Extracts the year component from an xs:dateTime value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:dateTime?DateTime value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:year-from-dateTime(xs:dateTime('2023-03-29T12:30:00'))2023
fn:year-from-dateTime(xs:dateTime('2023-03-29T12:30:00-08:00'))2023

+ W3C Documentation reference: Year-From-DateTime +
+ + + + + fn:dateTime(xs:date?, xs:time?) +
+ Constructs an xs:dateTime value from an xs:date and an xs:time value
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:date?Date value
xs:time?Time value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:dateTime(xs:date('2023-03-29'), xs:time('12:30:00'))2023-03-29T12:30:00
fn:dateTime(xs:date('2023-03-29+05:00'), xs:time('12:30:00-08:00'))2023-03-29T12:30:00-08:00

+ W3C Documentation reference: DateTime +
+ + + fn:seconds-from-duration(xs:duration?) +
+ Returns the seconds component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the seconds component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:seconds-from-duration(xs:dayTimeDuration('PT1H30M15.5S'))15.5
fn:seconds-from-duration(xs:dayTimeDuration('-PT2M10.3S'))-10.3

+ W3C Documentation reference: Seconds-From-Duration +
+ + + fn:minutes-from-duration(xs:duration?) +
+ Returns the minutes component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the minutes component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:minutes-from-duration(xs:dayTimeDuration('PT2H30M'))30
fn:minutes-from-duration(xs:dayTimeDuration('-PT1H45M'))-45

+ W3C Documentation reference: Minutes-From-Duration +
+ + + fn:hours-from-duration(xs:duration?) +
+ Returns the hours component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the hours component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:hours-from-duration(xs:dayTimeDuration('PT36H'))36
fn:hours-from-duration(xs:dayTimeDuration('-PT12H30M'))-12

+ W3C Documentation reference: Hours-From-Duration +
+ + + fn:days-from-duration(xs:duration?) +
+ Returns the days component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the days component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:days-from-duration(xs:dayTimeDuration('P5DT12H30M'))5
fn:days-from-duration(xs:dayTimeDuration('-P2DT6H'))-2

+ W3C Documentation reference: Days-From-Duration +
+ + + + fn:months-from-duration(xs:duration?) +
+ Returns the months component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the months component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:months-from-duration(xs:duration('P2Y3M4DT5H6M7S'))3
fn:months-from-duration(xs:duration('-P2Y3M4DT5H6M7S'))-3

+ W3C Documentation reference: Months-From-Duration +
+ + + fn:years-from-duration(xs:duration?) +
+ Returns the years component of the duration
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:duration?Duration from which to extract the years component
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:years-from-duration(xs:duration('P2Y3M4DT5H6M7S'))2
fn:years-from-duration(xs:duration('-P2Y3M4DT5H6M7S'))-2

+ W3C Documentation reference: Years-From-Duration +
+
+
+
+ + + +
+ + fn:trace(item()*, xs:string) +
+ Outputs the provided label and value for diagnostic purposes and returns the value + unchanged
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
item()*Value to be traced
xs:stringLabel to be output along with the value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:trace(42, 'The value is:')Outputs "The value is: 42" for diagnostic purposes and returns 42
fn:trace(/library/book/title, 'Book title:')Outputs "Book title: [book title]" for diagnostic purposes and returns + the book title

+ W3C Documentation reference: Trace +
+ + + fn:error(xs:QName?, xs:string?, $error-object) +
+ Raises an error with the specified error code, description, and error object
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:QName?Error code (optional)
xs:string?Description of the error (optional)
item()*Error object (optional)
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:error(xs:QName('err:FOER0000'))Raise error with the code err:FOER0000
fn:error(xs:QName('err:FOER0000'), 'Invalid value')Raise error with the code err:FOER0000 and description "Invalid value" +

+ W3C Documentation reference: Error +
+ +
+
+
+ + + +
+ + fn:xml-to-json(node(), map(*)) +
+ Converts an XML representation of a JSON value to its JSON serialization
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
node()XML representation of a JSON value
map(*)Options for the JSON serialization
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:xml-to-json('<map><string + key="name">John</string><number + key="age">30</number></map>')'{"name": "John", "age": 30}'
fn:xml-to-json('<array><number>1</number><number>2</number><number>3</number></array>') + '[1, 2, 3]'

+ W3C Documentation reference: XML-to-JSON +
+ + + fn:json-to-xml(item()) +
+ Converts a JSON value to its XML representation
+ Arguments and return type: + + + + + + + + + +
TypeDescription
item()JSON value to be converted
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:json-to-xml(map{"name": "John", "age": 30}) + <map> + <string key="name">John</string> + <number key="age">30</number> + </map> +
fn:json-to-xml([1, 2, 3]) + <array> + <number>1</number> + <number>2</number> + <number>3</number> + </array> +

+ W3C Documentation reference: JSON-to-XML +
+ + + fn:json-doc(xs:string) +
+ Parses a JSON document from a URI and returns the corresponding value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:stringURI of the JSON document to be parsed
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:json-doc('https://example.com/data.json')Parsed JSON value from the specified URI

+ W3C Documentation reference: JSON-Doc +
+ + + fn:parse-json(xs:string?) +
+ Parses a JSON string and returns the corresponding value
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:string?JSON string to be parsed
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:parse-json('{"name": "John", "age": 30}')map{"name": "John", "age": 30}
fn:parse-json('[1, 2, 3]')[1, 2, 3]

+ W3C Documentation reference: Parse-JSON +
+ + + fn:function-arity(function(*)) +
+ Returns the arity (number of arguments) of the specified function
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
function(*)The function to obtain the arity for
xs:integerThe arity (number of arguments) of the specified function
+ Examples:
+ + + + + + + + + +
ExpressionResult
function-arity(fn:substring)Returns the arity of the substring function: 2 (since + substring accepts two required arguments: the input string and the + starting index)

+ W3C Documentation reference: function-arity +
+ + + fn:function-name(function(*)) +
+ Returns the QName of the specified function
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
function(*)The function to obtain the QName for
xs:QName?The QName of the specified function, or an empty sequence if the + function is anonymous
+ Examples:
+ + + + + + + + + +
ExpressionResult
function-name(fn:substring)Returns the QName of the substring function: + QName("http://www.w3.org/2005/xpath-functions", "substring") +

+ W3C Documentation reference: function-name +
+ + + fn:function-lookup(xs:QName, xs:integer) +
+ Returns a function with the specified QName and arity if available, otherwise + returns an empty sequence
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
xs:QNameFunction name as QName
xs:integerArity of the function
function(*)?A function with the specified QName and arity if available, otherwise an + empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
function-lookup(QName('http://www.w3.org/2005/xpath-functions', + 'substring'), 2)Returns the substring function with arity 2, if available

+ W3C Documentation reference: function-lookup +
+ + + fn:static-base-uri() +
+ Returns the static base URI as an xs:anyURI, if available
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:anyURI?The static base URI, if available; otherwise, an empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
static-base-uri()Returns the static base URI as an xs:anyURI, if available, e.g., + 'https://www.example.com/base/'

+ W3C Documentation reference: static-base-uri +
+ + + fn:default-collation() +
+ Returns the default collation URI as an xs:string
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneFunction takes no arguments
xs:stringThe default collation URI as a string
+ Examples:
+ + + + + + + + + +
ExpressionResult
default-collation()Returns the default collation URI as an xs:string, e.g., + 'http://www.w3.org/2005/xpath-functions/collation/codepoint'

+ W3C Documentation reference: default-collation +
+ + + fn:serialize(item()?, item()?) +
+ Serializes an XML node, producing a string representation of the node
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()?An XML node to serialize
item()?Serialization options as a map, with key-value pairs defining the + serialization parameters (optional)
xs:string?A string representation of the serialized XML node or an empty sequence + if the input is an empty sequence
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:serialize(<item>Item 1</item>)Returns '<item>Item 1</item>'
fn:serialize(<item>Item 1</item>, map{'method': 'xml', 'indent': + 'yes'})Returns an indented XML string representation of the input node

+ W3C Documentation reference: serialize +
+ + + fn:parse-xml-fragment(xs:string?) +
+ Parses a string containing an XML fragment and returns a corresponding document + node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?A string containing an XML fragment
document-node(element(*))?A document node containing the parsed XML fragment or an empty sequence + if the input is an empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:parse-xml-fragment('<item>Item 1</item><item>Item + 2</item>')Returns a document node containing the parsed XML fragment

+ W3C Documentation reference: parse-xml-fragment +
+ + + fn:parse-xml(xs:string?) +
+ Parses a string containing an XML document and returns a corresponding document + node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?A string containing an XML document
document-node(element(*))?A document node containing the parsed XML content or an empty sequence + if the input is an empty sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:parse-xml('<root><item>Item 1</item></root>')Returns a document node containing the parsed XML content

+ W3C Documentation reference: parse-xml +
+ + + fn:available-environment-variables() +
+ Retrieves a sequence of the names of all available environment variables
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
NoneNo argument is required
xs:string*A sequence of the names of all available environment variables
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:available-environment-variables()Returns a sequence of the names of all available environment variables +

+ W3C Documentation reference: available-environment-variables +
+ + + fn:environment-variable(xs:string) +
+ Retrieves the value of an environment variable
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:stringThe name of the environment variable
xs:string?The value of the environment variable, or an empty sequence if the + variable is not set
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:environment-variable("PATH")Returns the value of the PATH environment variable, or an empty sequence + if the variable is not set

+ W3C Documentation reference: environment-variable +
+ + + fn:uri-collection(xs:string?) +
+ Returns a sequence of URIs in a collection identified by a URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI identifying the collection of URIs
xs:anyURI*A sequence of URIs in the collection
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:uri-collection("http://www.example.com/collection/")Returns a sequence of URIs in the collection identified by the specified + URI +
fn:uri-collection()Returns a sequence of URIs in the default collection, if one is defined +

+ W3C Documentation reference: uri-collection +
+ + fn:doc-available(xs:string?) +
+ Tests whether an XML document is available at a given URI
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI of the XML document to be tested
xs:booleanTrue if the XML document is available, otherwise false
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:doc-available("http://www.example.com/books.xml")Returns true if the XML document located at the specified URI is + available, otherwise false
fn:doc-available("")Returns true if the XML document containing the context item is + available, otherwise false

+ W3C Documentation reference: doc-available +
+ + + fn:doc(xs:string?) +
+ Loads an XML document from a URI and returns the document node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?The URI of the XML document to be loaded
document-node()?The document node of the loaded XML document
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:doc("http://www.example.com/books.xml")Loads the XML document located at the specified URI and returns its + document node
fn:doc("")Returns the document node of the XML document containing the context + item

+ W3C Documentation reference: doc +
+ + + fn:generate-id(node()?) +
+ Returns a unique identifier for the specified node
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
node()?Input node for which the unique identifier is to be generated
xs:stringUnique identifier for the specified node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:generate-id(/bookstore/book[1])A unique identifier for the first <book> element in the + <bookstore>
fn:generate-id(.)A unique identifier for the context node

+ W3C Documentation reference: generate-id +
+ + + fn:idref(xs:string*) +
+ Returns a sequence of nodes that are referenced by the specified IDREF attribute + values
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*Input sequence of IDREF attribute values
node()*Sequence of nodes referenced by the specified IDREF attribute values +
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:idref("reference42")Nodes referenced by the IDREF attribute value "reference42"
fn:idref(("ref1", "ref2", "ref3"))Nodes referenced by the IDREF attribute values "ref1", "ref2", and + "ref3"

+ W3C Documentation reference: idref +
+ + + fn:id(xs:string*) +
+ Returns a sequence of elements with the specified ID attribute values
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string*Input sequence of ID attribute values
element()*Sequence of elements with the specified ID attribute values
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:id("item42")Element with the ID attribute value "item42"
fn:id(("item1", "item2", "item3"))Elements with the ID attribute values "item1", "item2", and "item3"

+ W3C Documentation reference: id +
+ + + fn:lang(xs:string, node()?) +
+ Returns true if the language of the specified node or its nearest ancestor matches + the given language code
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:stringLanguage code to test
node()?Optional node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:lang("en", /book/title)true
fn:lang("fr", /book/title)false

+ W3C Documentation reference: lang +
+ + + + fn:in-scope-prefixes(element()) +
+ Returns a sequence of strings representing the prefixes of the in-scope namespaces + for the specified element
+ Arguments and return type: + + + + + + + + + +
TypeDescription
element()Element node
+ Examples:
+ + + + + + + + + +
ExpressionResult
fn:in-scope-prefixes(/*)("xml", "x")

+ W3C Documentation reference: in-scope-prefixes +
+ + + fn:namespace-uri-for-prefix(xs:string?, element()) +
+ Returns the namespace URI associated with the given prefix, using the in-scope + namespaces for the specified element
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Prefix
element()Element node
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:namespace-uri-for-prefix('x', /*)"http://www.example.com/ns"
fn:namespace-uri-for-prefix('', /*)""

+ W3C Documentation reference: namespace-uri-for-prefix +
+ + + fn:namespace-uri-from-QName(xs:QName?) +
+ Returns the namespace URI of the given QName value, or an empty sequence if there's + no namespace URI
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:QName?QName value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:namespace-uri-from-QName(fn:QName('http://www.example.com/ns', + 'x:local'))"http://www.example.com/ns"
fn:namespace-uri-from-QName(fn:QName('', 'local'))""

+ W3C Documentation reference: namespace-uri-from-QName +
+ + + fn:local-name-from-QName(xs:QName?) +
+ Returns the local name of the given QName value, or an empty sequence if there's no + local name
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:QName?QName value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:local-name-from-QName(fn:QName('http://www.example.com/ns', + 'x:local'))"local"
fn:local-name-from-QName(fn:QName('', 'local'))"local"

+ W3C Documentation reference: local-name-from-QName +
+ + + fn:prefix-from-QName(xs:QName?) +
+ Returns the prefix of the given QName value, or an empty sequence if there's no + prefix
+ Arguments and return type: + + + + + + + + + +
TypeDescription
xs:QName?QName value
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:prefix-from-QName(fn:QName('http://www.example.com/ns', 'x:local')) + "x"
fn:prefix-from-QName(fn:QName('', 'local'))()

+ W3C Documentation reference: prefix-from-QName +
+ + + fn:QName(xs:string?, xs:string) +
+ Constructs an xs:QName value from a namespace URI and a lexical QName
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?Namespace URI
xs:stringLexical QName
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:QName('http://www.example.com/ns', 'x:local')QName("http://www.example.com/ns", "x:local")
fn:QName('', 'local')QName("", "local")

+ W3C Documentation reference: QName +
+ + + fn:resolve-QName(xs:string?, element()) +
+ Resolves a QName by expanding a prefix using the in-scope namespaces of a given + element
+ Arguments and return type: + + + + + + + + + + + + + +
TypeDescription
xs:string?QName to resolve
element()Element with in-scope namespaces
+ Examples:
+ + + + + + + + + + + + + +
ExpressionResult
fn:resolve-QName('x:local', $element)QName("http://www.example.com/ns", "local")
fn:resolve-QName('local', $element)QName("", "local")

+ W3C Documentation reference: Resolve-QName +
+ + + + fn:nilled(node) +
+ Returns a Boolean value indicating whether the argument node is nilled
+
+ W3C Documentation reference: #func-nilled + +
+ + + + + +
+
+
+ + + +
+ + fn:for-each-pair(item()*, item()*, function(item(), item())) +
+ Applies a processing function to pairs of items from two input sequences in a + pairwise fashion, resulting in a sequence of the same length as the shorter input + sequence
+ Arguments and return type: + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The first input sequence of items
item()*The second input sequence of items
function(item(), item())The processing function used to process pairs of items from the input + sequences
item()*The resulting sequence after applying the processing function to pairs + of items
+ Examples:
+ + + + + + + + + +
ExpressionResult
for-each-pair((1, 2, 3), ("a", "b"), function($item1, $item2) { + concat($item1, $item2) })Returns a sequence with the concatenated pairs of items: + ("1a", "2b") +

+ W3C Documentation reference: for-each-pair +
+ + + + + fn:filter(item()*, function(item()) +
+ Filters a sequence of items based on a given predicate function
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
function(item())The predicate function used to filter the items
item()*The resulting sequence after applying the predicate function
+ Examples:
+ + + + + + + + + +
ExpressionResult
filter((1, 2, 3, 4), function($x) { $x mod 2 = 0 })Returns a new sequence containing only the even numbers from the input + sequence: (2, 4)

+ W3C Documentation reference: filter +
+ + + fn:for-each(item()*, function(item())) +
+ Applies a specified function to each item in a sequence, returning a new + sequence
+ Arguments and return type: + + + + + + + + + + + + + + + + + +
TypeDescription
item()*The input sequence of items
function(item())The function to apply to each item in the sequence
item()*The new sequence created by applying the function to each item in the + input sequence
+ Examples:
+ + + + + + + + + +
ExpressionResult
for-each((1, 2, 3, 4), function($x) { $x * 2 })Returns a new sequence with the result of doubling each number in the + input sequence: (2, 4, 6, 8)

+ W3C Documentation reference: for-each +
+ +
+
+
+
@@ -3414,24 +17147,27 @@ if (filter == "collapse3.0") { - document.getElementById("tooltipFunctionInfo").innerText = "XPath 1.0, 2.0 & 3.0 functions"; - showList(document.getElementsByName("collapse20")); + document.getElementById("tooltipFunctionInfo").innerText = "XPath 3.0 functions"; + hideList(document.getElementsByName("collapse10")); + hideList(document.getElementsByName("collapse20")); showList(document.getElementsByName("collapse30")); hideList(document.getElementsByName("collapse31")); - + } else if (filter == "collapse3.1") { - document.getElementById("tooltipFunctionInfo").innerText = "XPath 1.0, 2.0, 3.0 & 3.1 functions"; - showList(document.getElementsByName("collapse20")); - showList(document.getElementsByName("collapse30")); + document.getElementById("tooltipFunctionInfo").innerText = "XPath 3.1 functions"; + hideList(document.getElementsByName("collapse10")); + hideList(document.getElementsByName("collapse20")); + hideList(document.getElementsByName("collapse30")); showList(document.getElementsByName("collapse31")); - } else if (filter == "collapse2.0") { - document.getElementById("tooltipFunctionInfo").innerText = "XPath 1.0 & 2.0 functions"; + document.getElementById("tooltipFunctionInfo").innerText = "XPath 2.0 functions"; + hideList(document.getElementsByName("collapse10")); showList(document.getElementsByName("collapse20")); hideList(document.getElementsByName("collapse30")); hideList(document.getElementsByName("collapse31")); } else { document.getElementById("tooltipFunctionInfo").innerText = "XPath 1.0 functions"; + showList(document.getElementsByName("collapse10")); hideList(document.getElementsByName("collapse20")); hideList(document.getElementsByName("collapse30")); hideList(document.getElementsByName("collapse31")); @@ -3441,7 +17177,7 @@ var triggerList = document.getElementsByClassName("collapseTrigger"); for (i = 0; i < triggerList.length; i++) { - + triggerList[i].addEventListener("click", function () { var collapsible = this.parentElement; if (this.tagName == "A") { @@ -3451,7 +17187,7 @@ } - + if (collapsibleData.style.maxHeight > "0px") { collapsibleData.style.maxHeight = "0px"; @@ -3483,10 +17219,14 @@ } function init() { + // Make sure that only plain text is pasted + configurePastingInElement("xmlArea"); + configurePastingInElement("transformArea"); + //Handle clicks in whole form and set info in tooltip setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here'); setDefaultContent(document.getElementById("transformArea"), 'Insert XPath expression here'); - + processVersionSelector(); processTooltip(); tool.addEventListener('change', event => { @@ -3521,8 +17261,10 @@ }) } + + - + \ No newline at end of file diff --git a/Frontend/tools/xsd.html b/Frontend/tools/xsd.html index 4cfbd35..100756b 100644 --- a/Frontend/tools/xsd.html +++ b/Frontend/tools/xsd.html @@ -4,7 +4,11 @@ + + + + @@ -36,32 +40,25 @@ + onclick="fillDefaultXSD(this);">Insert default XML/XSD
- -

+
+
- +

-

+
- +
@@ -84,6 +81,10 @@ + + + + @@ -25,7 +31,7 @@ -

+
+
- - +
+ +
+ +
+
+

-

+
- +
@@ -1144,7 +1149,7 @@ diff --git a/Samples/xsd/schema.xsd b/Samples/xsd/schema.xsd deleted file mode 100644 index b36116c..0000000 --- a/Samples/xsd/schema.xsd +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Samples/xslt/sampleXSLT.xslt b/Samples/xslt/sampleXSLT.xslt index 178e5a0..00f662d 100644 --- a/Samples/xslt/sampleXSLT.xslt +++ b/Samples/xslt/sampleXSLT.xslt @@ -1,4 +1,4 @@ - + diff --git a/Swagger/swagger.json b/Swagger/swagger.json index e38e77b..be32787 100644 --- a/Swagger/swagger.json +++ b/Swagger/swagger.json @@ -540,7 +540,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/Response" + "$ref": "#/definitions/XPathResponse" } } }, @@ -1006,6 +1006,39 @@ } } }, + "XPathResponse": { + "type": "object", + "properties": { + "result": { + "type": "string", + "example": "4", + "description": "Result of performing transformation on provided XML" + }, + "time": { + "type": "string", + "example": "320", + "description": "Computation time in milliseconds" + }, + "processor": { + "type": "string", + "enum": [ + "Saxon 10.3 2.0 over s9api", + "Xalan Java 2.7.2", + "libXml over lxml" + ] + }, + "status": { + "type": "string", + "enum": [ + "OK" + ] + }, + "type": { + "type": "string", + "description": "Optional. Specifies type of data returned by Xalan or libXML." + } + } + }, "ResponseError": { "type": "object", "properties": {