From f011e5efffc79f42533f464a0581304aefe54463 Mon Sep 17 00:00:00 2001 From: Adam Bem Date: Wed, 29 Mar 2023 11:03:34 +0200 Subject: [PATCH] Added accessors --- Frontend/tools/xpath.html | 372 +++++++++++++++++++++++++++++++------- 1 file changed, 304 insertions(+), 68 deletions(-) diff --git a/Frontend/tools/xpath.html b/Frontend/tools/xpath.html index a7e30d1..89be05f 100644 --- a/Frontend/tools/xpath.html +++ b/Frontend/tools/xpath.html @@ -415,13 +415,210 @@
+ 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)).
+
+ Arguments: + + + + + + + + + +
TypeDescription
node?Node to display name.
+ Return type: xs:string

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

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

+ + W3C Documentation reference +
+ + fn:last()
- Returns the position of the last node in the context list
-
- W3C Documentation reference: Node-Set-Functions + Returns the position of the last node in the context list
+
+ W3C Documentation reference: Node-Set-Functions
+ + @@ -487,7 +684,15 @@ fn:string(object)
- Returns the string representation of the object argument
+ 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.
+ + If the context item is undefined, error [err:XPDY0002]XP is raised.
+ + If $arg is the empty sequence, the zero-length string is returned.
+ + 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.
+ + 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: @@ -513,7 +718,7 @@
0.11

- W3C Documentation reference: String-Functions + W3C Documentation reference
@@ -528,43 +733,30 @@ fn:number(object) + class="hyperlink collapsible collapsibleMini collapseTrigger">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 and return type: - - - - - - - - - -
TypeDescription
objectThe object to convert to a number
- Examples:
- - - - - - - - - - - - - -
ExpressionResult
boolean("Release11")true
boolean("")false

- W3C Documentation reference: Numeric-Functions + 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
@@ -577,31 +769,47 @@
fn:avg((arg,arg,...)) + class="hyperlink collapsible collapsibleMini collapseTrigger">fn:data()
- 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 + 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
@@ -658,9 +866,37 @@ fn:error()
- https://www.w3.org/TR/xpath-functions/#func-error
-
- W3C Documentation reference: #func-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