Xquery / Xpath /* 是什么意思:
(:这里 $patterns 看起来像<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)
)
};