Changes

Jump to navigation Jump to search
468 bytes added ,  11:39, 18 January 2021
no edit summary
|-
| '''Summary'''
|Returns {{Code|$items}} if it is a non-empty sequence. Otherwise, returns {{Code|$default}}. The function is equivalent Equivalent to one of the following expressions:* <codesyntaxhighlight lang="xquery">if(exists($items)) then $items else $default</code>,(: Elvis operator :)* <code>$items ?: $default</codesyntaxhighlight> (see [[XQuery Extensions#Elvis Operator|Elvis Operator]] for more details)
|-
| '''Examples'''
|-
| '''Summary'''
|Checks if the specified {{Code|$sequence}} has at least {{Code|$min}} and, optionally, at most {{Code|$max}} items. Equivalent to :<codesyntaxhighlight lang="xquery">let $count := count($sequence) return $count >= $min and $count <= $max</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns the item from {{Code|$sequence}} at the specified {{Code|$position}}. Equivalent to :<codesyntaxhighlight lang="xquery">$sequence[$position]</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns items from {{Code|$sequence}}, starting at position {{Code|$first}} and ending at {{Code|$last}}. Equivalent to :<codesyntaxhighlight lang="xquery">subsequence($sequence, $first, $last - $first + 1)</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns last item of a {{Code|$sequence}}. Equivalent to :<codesyntaxhighlight lang="xquery">$sequence[last()]</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all items of a {{Code|$sequence}} except for the last one. Equivalent to :<codesyntaxhighlight lang="xquery">$sequence[position() < last()]</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns nodes in ''distinct document order'': duplicate nodes will be removed, and the remaining nodes will be returned in [https://www.w3.org/TR/xquery-31/#dt-document-order document order]. All results of path expression expressions are in distinct document order, so the function is equivalent to the expression :<codesyntaxhighlight lang="xquery">$nodes/self::node()</codesyntaxhighlight>.
|}
|-
| '''Summary'''
|Returns the document nodes of the specified {{Code|$nodes}}. The function is equivalent to the expression <code>$nodes ! /</code>. The path expression <code>/abc</code>is internally represented as <code>util:root(.)/abc</code.Equivalent to:<syntaxhighlight lang="xquery">$nodes ! /</syntaxhighlight>
|}
|-
| '''Summary'''
|Returns each member of an {{Code|$array}} as a new array. Equivalent to: <codesyntaxhighlight lang="xquery">for $a in 1 to array:size($array) return [ $array($a) ]</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all members of an {{Code|$array}} as a sequence. Equivalent Better composable and easier to {{Code|read than the equivalent, but shorter expression:<syntaxhighlight lang="xquery">$array?*}}, but better composable and easier to read.</syntaxhighlight>
|-
| '''Examples'''
|-
| '''Summary'''
|Returns each entry of a {{Code|$map}} as a new map, each with a {{Code|key}} and {{Code|value}} entry. Equivalent to: <codesyntaxhighlight lang="xquery">map:for-each($map, function($key, $value) { map { "key": $key, "value": $value } })</codesyntaxhighlight>.
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all values of a {{Code|$map}} as a sequence. Equivalent Better composable and easier to {{Code|read than the equivalent, but shorter expression:<syntaxhighlight lang="xquery">$map?*}}, but better composable and easier to read.</syntaxhighlight>
|-
| '''Examples'''
|-
| '''Summary'''
|Evaluates {{Code|$input}} and returns the result {{Code|$count}} times. Unless {{Code|$multiple}} is enabled, the input expression is only evaluated once. The function call Equivalent expressions:<codesyntaxhighlight lang="xquery">util:replicate($input, $count, true())</code> is equivalent to <code>,(1 to $count) ! $input</codesyntaxhighlight>.
|-
| '''Errors'''
|-
| '''Summary'''
|Inserts the defined {{Code|$separator}} between the {{Code|$items}} of a sequence and returns the resulting sequence. The function is equivalent Equivalent to:<br/syntaxhighlight lang="xquery"><code>head($items), for $item in tail($items) return ($separator, $item)</codesyntaxhighlight>
|-
| '''Examples'''
|-
| '''Summary'''
|Returns all characters of a {{Code|$string}} as a sequence. Equivalent to :<codesyntaxhighlight lang="xquery">for $cp in string-to-codepoints($string) ! return codepoints-to-string(.$cp)</codesyntaxhighlight>.
|-
| '''Examples'''
Bureaucrats, editor, reviewer, Administrators
13,551

edits

Navigation menu