In the code above you can se a localization macros instaed of strings. Localization macro looks like following;
# localization-variable-name / localization-item-tag #
This construction is replaced by XPath expression that retrieves required string. So, for the macro
#strings/header#
we have a replacement as follows:
mdo:coalesce(
$strings/header/value[@culture=mdo:culture()],
$strings/header/value[position()=1])
As you can see, XsltDb determines current language and tries to select a value for that language. if a value is not found it uses the first value. So it is better to put most frequent language on top.
Note, that the localization XML is declared in 2 stages:
- first, we declare an XML fragment $_strings that contains out labels.
- second, we create a queryable variable $strings that can be queried extremely fast.