lang Function

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XPath Reference

lang Function

Returns true if the xml:lang attribute of the context node is the same as a sublanguage of the language specified by the argument string.

Syntax

boolean lang(string)

Remarks

The language of the context node is determined by the value of the xml:lang attribute on the context node, or if the context node has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the context node that has an xml:lang attribute. 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:

<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:

lang("en")

See Also

Data Types in Schemas | XDR Schema Data Types Reference | XML Data Types Reference