Skip to Content
XQuery
book

XQuery

by Priscilla Walmsley
March 2007
Intermediate to advanced content levelIntermediate to advanced
512 pages
21h 15m
English
O'Reilly Media, Inc.
Content preview from XQuery

xs:language

The type xs:language represents a natural language. It is often used for attributes that specify the language of the element. Its values conform to RFC 3066, Tags for the Identification of Languages. The most common format is a two- or three-character, (usually lowercase) language code that follows ISO 639, such as en or fr. It can optionally be followed by a hyphen and a two-character (usually uppercase) country code that follows ISO 3166, such as en-US. Additional dialects or country codes may be specified at the end of the value, each preceded by a hyphen.

Processors do not verify that values of the language type conform to the above rules. They simply validate based on the pattern specified for this type, which says that the value must consist of parts containing one to eight characters, separated by hyphens.

The xs:language type is most commonly associated with the xml:lang attribute defined in the XML specification; the value of this attribute may be tested using the lang function. Table B-18 lists some values of the xs:language type.

Table B-18. Values of the xs:language type

Values

Explanation

Valid

 
en

English

en-US

U.S. English

en-GB

U.K. English

de

German

es

Spanish

fr

French

it

Italian

ja

Japanese

nl

Dutch

zh

Chinese

any-value-with-short-parts

Although this value is valid, it does not follow RFC 3066 guidelines

Invalid

 
longerThan8

Parts may not exceed eight characters in length

 

An empty value or zero-length string is not permitted ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XQuery, 2nd Edition

XQuery, 2nd Edition

Priscilla Walmsley
XPath and XPointer

XPath and XPointer

John Simpson
XQuery Kick Start

XQuery Kick Start

James McGovern, Per Bothner, Kurt Cagle, James Linn, Vaidyanathan Nagarajan
Learning XSLT

Learning XSLT

Michael Fitzgerald

Publisher Resources

ISBN: 0596006349Supplemental ContentErrata