Parameter

$default-lang (default: 'lv')

Key

routes-by-lang-path

matches//route
indexed byconcat(@lang, '|', @path)
Key

routes-by-lang

matches//route
indexed by@lang
Key

child-routes

matches//route
indexed byconcat(generate-id(..), '|', @lang, '|', @path)
Variable

$full-path

/context/request/path/@full
Variable

$lang

templateroute-content
parameter$route=/context/request/@route
apply/context/request/pathin mode resolve-page
with$route=$route
matchpath[@is-root='true']mode: resolve-pagepriority: 3
$home-routekey('routes-by-lang-path', concat($lang, '|/'))
when$home-route
apply$home-route/..in mode render
otherwise
callnot-found
matchpath[@is-root='true']mode: resolve-langpriority: 3
whenkey('routes-by-lang-path', 'lv|/')
whenkey('routes-by-lang-path', 'en|/')
otherwise
$default-lang
matchpathmode: resolve-langpriority: 1
whenkey('routes-by-lang-path', concat('lv|', $full-path))
whenkey('routes-by-lang-path', concat('en|', $full-path))
otherwise
$seg1segment[1]
when$seg1 and key('routes-by-lang-path', concat('lv|/', $seg1/@text, '/'))
when$seg1 and key('routes-by-lang-path', concat('en|/', $seg1/@text, '/'))
otherwise
$default-lang
matchpathmode: resolve-pagepriority: 1
$seg1segment[1]
$exact-routekey('routes-by-lang-path', concat($lang, '|', $full-path))
when$exact-route
apply$exact-route/..in mode render
otherwise
$container-routekey('routes-by-lang-path', concat($lang, '|/', $seg1/@text, '/'))
$out
if$container-route
apply$container-route/..in mode descend
with$seg=$seg1/segment[1]
with$lang=$lang
whenboolean(exsl:node-set($out)/node())
copy ofexsl:node-set($out)/node()
otherwise
callnot-found
matchpathmode: resolve-pagepriority: 0
callnot-found
match*mode: render
apply.
match*mode: descend
parameter$seg
parameter$lang
whennot($seg)
apply.in mode render
otherwise
$slug$seg/@text
$next-element*[route[@lang=$lang and (@path=$slug or @path=concat($slug, '/'))]]
if$next-element
apply$next-elementin mode descend
with$seg=$seg/segment[1]
with$lang=$lang
templatenot-found
html
apply/context/request/pathin mode no-route
templateget-route-path
parameter$element=.
parameter$lang=$lang
$element/route[@lang=$lang]/@path
templatebuild-url
parameter$element=.
parameter$lang=$lang
if$element/..
callbuild-url
withelement$element/..
withlang$lang
$element/route[@lang=$lang]/@path