Added String category to XPath 2.0

This commit is contained in:
2023-06-28 11:52:02 +02:00
parent 653caa8675
commit cbfb8971ed

View File

@@ -243,6 +243,693 @@
}
]
},
{
"name": "String",
"entries": [
{
"name": "string()",
"description": "Returns the value of $arg represented as a xs:string. If no argument is supplied, the context item (.) is used as the default argument.",
"arguments": [
{
"type": "item()?",
"description": "$arg"
}
],
"output": "xs:string",
"examples": [
{
"command": "string((1<0))",
"output": "false"
},
{
"command": "string(.11)",
"output": "0.11"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-string"
},
{
"name": "codepoints-to-string()",
"description": "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": [
{
"type": "xs:integer* (One or more)",
"description": "$arg"
}
],
"output": "xs:string",
"examples": [
{
"command": "codepoints-to-string((2309, 2358, 2378, 2325))",
"output": "अशॊक"
},
{
"command": "codepoints-to-string((40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41))",
"output": "( ͡° ͜ʖ ͡°)"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-codepoints-to-string"
},
{
"name": "string-to-codepoints()",
"description": "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": [
{
"type": "xs:string* (One or more)",
"description": "$arg"
}
],
"output": "xs:integer* (One or more)",
"examples": [
{
"command": "string-to-codepoints('Thérèse')",
"output": "https://www.w3.org/TR/xquery-operators/#func-string-to-codepoints"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-min"
},
{
"name": "compare()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$comparand1"
},
{
"type": "xs:string? (Optional)",
"description": "$comparand2"
},
{
"type": "xs:string? (Optional)",
"description": "$collation"
}
],
"output": "xs:integer? (Optional)",
"examples": [
{
"command": "compare('abc', 'abc')",
"output": "0"
},
{
"command": "compare('abc', 'acc')",
"output": "-1"
},
{
"command": "compare('abc', 'acc')",
"output": "1"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-compare"
},
{
"name": "codepoint-equal()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$comparand1"
},
{
"type": "xs:string? (Optional)",
"description": "$comparand2"
},
{
"type": "xs:string",
"description": "$collation"
}
],
"output": "xs:boolean? (Optional)",
"examples": [
{
"command": "codepoint-equal('asdf', 'asdf')",
"output": "true"
},
{
"command": "codepoint-equal('asdf', 'asdf ')",
"output": "false"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-codepoint-equal"
},
{
"name": "concat()",
"description": " 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.",
"arguments": [
{
"type": "xs:anyAtomicType? (Optional)",
"description": "$arg1"
},
{
"type": "xs:anyAtomicType? (Optional)",
"description": "$arg2"
},
{
"type": "xs:anyAtomicType? (Optional)",
"description": "$arg.."
}
],
"output": "xs:string",
"examples": [
{
"command": "concat('un', 'grateful')",
"output": "ungrateful"
},
{
"command": "concat('Thy ', (), 'old ', 'groans', '', ' ring', ' yet', ' in', ' my', 'ancient',' ears.')",
"output": "Thy old groans ring yet in my ancient ears."
},
{
"command": "concat('Ciao!',())",
"output": "Ciao!"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-concat"
},
{
"name": "string-join()",
"description": "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.",
"arguments": [
{
"type": "xs:string* (One or more)",
"description": "$arg1"
},
{
"type": "xs:string",
"description": "$arg2"
},
{
"type": "xs:string",
"description": "$collation"
}
],
"output": "xs:string",
"examples": [
{
"command": "string-join(('Now', 'is', 'the', 'time', '...'), ' ')",
"output": "Now is the time ..."
},
{
"command": "string-join(('Blow, ', 'blow, ', 'thou ', 'winter ', 'wind!'), '')",
"output": "Blow, blow, thou winter wind!"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-string-join"
},
{
"name": "substring()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$comparand1"
},
{
"type": "xs:double",
"description": "$startingLoc"
},
{
"type": "xs:double? (Optional)",
"description": "$length"
}
],
"output": "xs:string",
"examples": [
{
"command": "substring('motor car', 6)",
"output": "' car'"
},
{
"command": "substring('metadata', 4, 3)",
"output": "ada"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-substring"
},
{
"name": "string-length()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg"
}
],
"output": "xs:integer",
"examples": [
{
"command": "string-length('Harp not on that string, madam; that is past.')",
"output": "45"
},
{
"command": "string-length(())",
"output": "0"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-string-length"
},
{
"name": "normalize-space()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg"
}
],
"output": "xs:string",
"examples": [
{
"command": "normalize-space(' The wealthy curled darlings of our nation. ')",
"output": "The wealthy curled darlings of our nation.'"
},
{
"command": "normalize-space(())",
"output": "''"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-normalize-space"
},
{
"name": "normalize-unicode()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg"
},
{
"type": "xs:string? (Optional)",
"description": "$normalizationForm"
}
],
"output": "xs:string",
"examples": [
{
"command": "normalize-unicode('test ')",
"output": "'test'"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-normalize-unicode"
},
{
"name": "upper-case()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg"
}
],
"output": "xs:string",
"examples": [
{
"command": "upper-case('abCd0')",
"output": "ABCD0"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-upper-case"
},
{
"name": "substring()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg"
}
],
"output": "xs:string",
"examples": [
{
"command": "lower-case('abCd0')",
"output": "abcd0"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-lower-case"
},
{
"name": "translate()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg"
},
{
"type": "xs:string",
"description": "$mapString"
},
{
"type": "xs:string",
"description": "$mapString"
}
],
"output": "xs:string",
"examples": [
{
"command": "translate('bar','abc','ABC')",
"output": "BAr"
},
{
"command": "translate('--aaa--','abc-','ABC')",
"output": "AAA"
},
{
"command": "translate('abcdabc', 'abc', 'AB')",
"output": "ABdAB"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-translate"
},
{
"name": "encode-for-uri()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$uri-part"
}
],
"output": "xs:string",
"examples": [
{
"command": "encode-for-uri('https://www.google.com')",
"output": "https%3A%2F%2Fwww.google.com"
},
{
"command": "concat('http://www.example.com/', encode-for-uri('~bébé'))",
"output": "http://www.example.com/~b%C3%A9b%C3%A9"
},
{
"command": "concat('http://www.example.com/', encode-for-uri('100% organic'))",
"output": "http://www.example.com/100%25%20organic"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-encode-for-uri"
},
{
"name": "iri-to-uri()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$iri"
}
],
"output": "xs:string",
"examples": [
{
"command": "iri-to-uri ('http://www.example.com/00/Weather/CA/Los%20Angeles#ocean')",
"output": "http://www.example.com/00/Weather/CA/Los%20Angeles#ocean"
},
{
"command": "iri-to-uri ('http://www.example.com/~bébé')",
"output": "http://www.example.com/~b%C3%A9b%C3%A9"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-iri-to-uri"
},
{
"name": "escape-html-uri()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$uri"
}
],
"output": "xs:string",
"examples": [
{
"command": "escape-html-uri('http://www.example.com/00/Weather/CA/Los Angeles#ocean')",
"output": "http://www.example.com/00/Weather/CA/Los Angeles#ocean'"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-escape-html-uri"
},
{
"name": "contains()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg1"
},
{
"type": "xs:string? (Optional)",
"description": "$arg2"
},
{
"type": "xs:string? (Optional)",
"description": "$collation"
}
],
"output": "xs:boolean",
"examples": [
{
"command": "contains( 'tattoo', 'tat')",
"output": "true"
},
{
"command": "contains( 'tattoo', 'ttt')",
"output": "false"
},
{
"command": "contains ( '', ())",
"output": "true"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-contains"
},
{
"name": "starts-with(()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg1"
},
{
"type": "xs:string? (Optional)",
"description": "$arg2"
},
{
"type": "xs:string? (Optional)",
"description": "$collation"
}
],
"output": "xs:boolean",
"examples": [
{
"command": "starts-with('tattoo', 'tat')",
"output": "true"
},
{
"command": "starts-with('tattoo', 'ttt')",
"output": "false"
},
{
"command": "starts-with ( '', ())",
"output": "true"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-starts-with"
},
{
"name": "ends-with(()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg1"
},
{
"type": "xs:string? (Optional)",
"description": "$arg2"
},
{
"type": "xs:string? (Optional)",
"description": "$collation"
}
],
"output": "xs:boolean",
"examples": [
{
"command": "ends-with('tattoo', 'too')",
"output": "true"
},
{
"command": "ends-with( 'tattoo', 'tatoo')",
"output": "false"
},
{
"command": "ends-with ( '', ())",
"output": "true"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-ends-with"
},
{
"name": "substring-before(()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg1"
},
{
"type": "xs:string? (Optional)",
"description": "$arg2"
},
{
"type": "xs:string? (Optional)",
"description": "$collation"
}
],
"output": "xs:string",
"examples": [
{
"command": "substring-before( 'tattoo', 'too')",
"output": "tat"
},
{
"command": "substring-before( 'tattoo', 'tat')",
"output": "''"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-substring-before"
},
{
"name": "substring-after()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$arg1"
},
{
"type": "xs:string? (Optional)",
"description": "$arg2"
},
{
"type": "xs:string? (Optional)",
"description": "$collation"
}
],
"output": "xs:string",
"examples": [
{
"command": "substring-after( 'tattoo', 'too')",
"output": "''"
},
{
"command": "substring-after( 'tattoo', 'tat')",
"output": "too"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-substring-after"
},
{
"name": "matches()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$input"
},
{
"type": "xs:string? (Optional)",
"description": "$pattern"
},
{
"type": "xs:string? (Optional)",
"description": "$flags"
}
],
"output": "xs:boolean",
"examples": [
{
"command": "matches('abracadabra', 'bra')",
"output": "true"
},
{
"command": "matches('abracadabra', '^a.*a$')",
"output": "false"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-matches"
},
{
"name": "replace()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$comparand1"
},
{
"type": "xs:string",
"description": "$startingLoc"
},
{
"type": "xs:string",
"description": "$replacement"
},
{
"type": "xs:string? (Optional)",
"description": "$flags"
}
],
"output": "xs:string",
"examples": [
{
"command": "replace('abracadabra', 'bra', '*')",
"output": "a*cada*"
},
{
"command": "replace('abracadabra', 'a.*a, '*')",
"output": "ada"
},
{
"command": "replace('AAAA', 'A+', 'b')",
"output": "b"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-replace"
},
{
"name": "tokenize()",
"description": "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.",
"arguments": [
{
"type": "xs:string? (Optional)",
"description": "$comparand1"
},
{
"type": "xs:string",
"description": "$pattern"
},
{
"type": "xs:string? (Optional)",
"description": "$flags"
}
],
"output": "xs:string* (One or more)",
"examples": [
{
"command": "tokenize('The cat sat on the mat', '\\s+')",
"output": "('The', 'cat', 'sat', 'on', 'the', 'mat')"
},
{
"command": "tokenize('1, 15, 24, 50', '\\s*')",
"output": "('1', '15', '24', '50')"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xquery-operators/#func-tokenize"
}
]
},
{
"name": "Number",
"entries": [