Changes

Jump to navigation Jump to search
65 bytes removed ,  14:08, 13 July 2020
no edit summary
return 2 * 3
(: will be rewritten to :)
for $i in 1 to 10
return 6
return 'Results: ' || count($nodes)
(: will be rewritten to :)
let $nodes := //nodes
where true()
return 'Results: ' || count($nodes)
(: will be rewritten to :)
let $nodes := //nodes
return 'Results: ' || count($nodes)
(: will be rewritten to :)
'Results: ' || count(//nodes)
</syntaxhighlight>
return local:inc($n)
(: will be rewritten to :)
for $n in 1 to 5
return (
)
(: will be rewritten to :)
for $n in 1 to 5
return $n + 1
default return 'string'
(: will be rewritten to :)
for $i in 1 to 5
return 'number'
==Paths==
Due to the compact syntax of XPath, it can make a big difference if a slash is added or omitted in a path expression. A classical example is the double slash {{Code|//}}, which is a shortcut for {{Code|descendant-or-node()/}}. If the query is evaluated without optimizations, all nodes of a document will be are gathered, and for each of them, the next step will be is evaluated. This leads to a potentially huge number of duplicate node tree traversals, most of which are redundant, as all duplicate nodes will be removed at the end anyway.
In most cases, paths with a double slash can be rewritten to descendant steps…
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu