Reputation: 21
Xquery / Xpath what is the meaning of /*:
(: Here $patterns looks like <pattern match="something" replace="else" />
:)
declare function local:transform($text as text(), $patterns as element(pattern)*) {
if(not($patterns)) then
$text
else
let $patternsremaining := $patterns[position() > 1],
$modifiedtext := replace($text, $pattern/@match, $pattern/@replace)
return
if($local:language="French" and not($patterns[@match='le'])) then (
local:transform($modifiedtext, ($patternsremaining, <pattern match="Londres" replace="London" />))
)
else(
local:transform($modifiedtext, $patternsremaining)
)
};
Upvotes: 2
Views: 2554
Reputation: 243449
/*
is an XPath expression that selects all element children of the root (document) node.
It is equivalent to:
/child::*
As any well-formed XML document must have exactly one top element (child of the document node), the above two expressions select exactly one element -- the top element of the XML document.
Upvotes: 2