Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Returns True if the xml:langattribute of the context node is the same as a sublanguage of the language specified by the argument string.
Syntax
boolean lang( string) |
Parameters
- string
-
A string specifying a language.
Return Value
Returns True if the xml:langattribute of the context node is the same as a sublanguage of the language specified by the argument string.
Remarks
The language of the context node is determined by the
value of the
xml:langattribute on the context node, or if the context
node has no
xml:langattribute, by the value of the
xml:langattribute on the nearest ancestor of the context
node that has an
xml:langattribute. If there is no such attribute,
lang()returns False. If there is such an attribute,
lang()returns True if the attribute value is equal to the
argument (ignoring case) or if there is a suffix starting with "
-
", such that the attribute value is equal to the
argument, ignoring the suffix of the attribute value and ignoring
case.
Given the following XML elements:
Copy Code | |
---|---|
<para xml:lang="en"/> <div xml:lang="en"><para/></div> <para xml:lang="EN"/> <para xml:lang="en-us"/> |
The following function call returns True for all.
Copy Code | |
---|---|
lang("en") |