RE: lang("en-us")

The reference to a "sublanguage" occurs in the summary of the fn:lang
function description, which explains the overall intended purpose. The
detailed mechanics of the function are described a few paragraphs below, as

"...the function returns true if and only if the string-value of the
relevant xml:lang attribute is equal to $testlang based on a caseless
default match as specified in section 3.13 of [The Unicode Standard], or if
the string-value of the relevant testlang attribute contains a hyphen, "-"
(The character "-" is HYPHEN-MINUS, #x002D) such that the part of the
string-value preceding that hyphen is equal to $testlang, using caseless

So with xml:lang="en-us-ca" in scope, lang("en"), lang("en-us"), and
lang("en-us-ca") should all return true, as will expressions such as

(I don't know if there was a good reason for it to use the string-value of
the attribute rather than the typed-value, but it does. Using the
string-value means you can't rely on leading and trailing spaces being

(personal response)

Michael Kay

> -----Original Message-----
> From: 
> [] On Behalf Of zia
> Sent: 05 December 2006 13:41
> To:
> Subject: fn:lang("en-us")
> Hi,
> What should be the output of my expression fn:lang("en-us") 
> if xml:lang="en-us-ca" is specified for my context node.
> Should "en-us-ca" be considered as the sub language of 
> "en-us" or not ?
> Thanks and Regards,
> Zia
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
> This e-mail message may contain proprietary, confidential or 
> legally privileged information for the sole use of the person 
> or entity to whom this message was originally addressed. Any 
> review, e-transmission dissemination or other use of or 
> taking of any action in reliance upon this information by 
> persons or entities other than the intended recipient is 
> prohibited. If you have received this e-mail in error kindly 
> delete  this e-mail from your records. If it appears that 
> this mail has been forwarded to you without proper authority, 
> please notify us immediately at and delete 
> this mail. 
> _____________________________________________________________________

Received on Tuesday, 12 December 2006 10:51:16 UTC