Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Table of Contents

Search

  1. Preface
  2. Understanding Data Types and Field Properties
  3. Designing Processes
  4. Using and Displaying Data
  5. Designing Guides
  6. Designing Process Objects
  7. Designing Service Connectors
  8. Using App Connections
  9. System Services, Listeners and Connectors
  10. Designing Human Tasks

Design

Design

lang

lang

The lang function in XQuery is used to determine whether a node's language attribute matches a specified language. This function is particularly useful for querying XML documents that use language attributes to manage multilingual content.

Syntax

fn:lang(testlang, node)
The following table describes the argument for this command:
Argument
Required/Optional
Description
testlang
Required
The language tag to test against the
xml:lang
attribute of the
node
. It typically follows language tagging conventions, such as "en", "fr", and "en-US". This parameter must be provided as a string.
node
Required
The context node whose language attribute is to be tested. If omitted, the context item from which the function is called is used by default.

Return Value

  • Returns
    true
    if the
    xml:lang
    attribute of the node or its nearest ancestor matches the
    $testlang
    value.
  • Returns
    false
    if there is no match or if
    xml:lang
    is absent.

Examples

The following table lists some sample XML structures, queries, and return values:
XML STRUCTURE
QUERY
OUTPUT
<book xml:lang="en"> <title>Hello World</title> </book>
fn:lang("en", /book/title)
true
<book xml:lang="fr"> <title>Bonjour le Monde</title> </book
fn:lang("en", /book/title)
false
<article xml:lang="en-US"> <section> <para>This is a paragraph.</para> </section> </article>
fn:lang("en-US")
true
<document> <content>Some text here.</content> </document>
fn:lang("en", /document/content)
false

0 COMMENTS

We’d like to hear from you!