Message
xml:lang or hreflang attribute "$languageCodeError" should contain a valid language code (using the shortest ISO 639), potentially followed
by a script code and region code
xml:lang or hreflang attribute "$languageCodeError" should contain a valid language code (using the shortest ISO 639), potentially followed
by a script code and region code
This rule ASSERTS the following, raising an alert if FALSE:
let $languageCodeError := (@xml:lang | @hreflang)[not(matches(., '^[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*$')
and (tokenize(., '-')[1] = $langauge-codes//language/@code))] returnempty($languageCodeError)