This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I was wondering about the following situations: * fn:lang('en', /), I think this never matches (root node has no xml:lang attribute) * fn:lang('', x), given any xml:lang attribute. The spec suggests that this never matches because after a "start-with" match, the remnant should start with "-" * fn:lang('', x) when <x xml:lang="-" />, I think this should match, but we do not say anything about whether we ought to match invalid languages. Note that xs:lang("-") is invalid * fn:lang('-en', x) when <x xml:lang="-en" />, I think this should match for the same reasons. * fn:lang('-', x) when <x xml:lang="--" />, I think this should match too (the spec says that after a "start-with" match, the remnant should start with "-") * fn:lang(' en-US', x) when <x xml:lang=" en-US " />, I think this should not match (space is significant) Note that the text says, point (2): "$testlang is equal to some substring of the string-value". I'm not sure why the word "some" is chosen, as there seems to be at most one such substring that starts at the beginning of the string. If there's a possibility in an up-and-coming erratum to clarify this, I'd suggest to add something like: * The above rules do not validate the xml:lang value, nor do they impose a maximum length, where the xs:language type would have such restrictions. * Whitespace in the xml:lang value is significant * The empty string matches only when xml:lang starts with a dash. PS: I don't think the spec is in error here, the rules, when applied literally, leave little or no wiggle room