Please enable JavaScript to view this site.

Altova MapForce 2020 Professional Edition

The following XPath 2 node functions are available:

 

lang

The lang function takes a string argument that identifies a language code (such as en). The function returns true or false depending on whether the context node has an xml:lang attribute with a value that matches the argument of the function.

 

FXxpath10

 

In the screenshot above notice the following:

 

1.In the source schema, the Language element has an xml:lang attribute.

2.Language nodes are filtered so that only those Language nodes having an xml:lang value of en are processed (the filter test is specified in the equal function).

3.The Language node is the context node at the point where the en element is created in the output document.

4.The output of the lang function (true or false) is sent to the en/@exists attribute node of the output. The argument of the function is provided by the string constant en. The lang function then checks whether the context node at this point (the Language element) has an xml:lang attribute with a value of en (the argument of the function). If yes, then true is returned, otherwise false.

 

local-name, name, namespace-uri

The local-name, name, and namespace-uri functions, return, respectively, the local-name, name, and namespace URI of the input node. For example, for the node altova:Products, the local-name is Products, the name is altova:Products, and the namespace URI is the URI of the namespace to which the altova: prefix is bound (say, http://www.altova.com/mapforce).

 

Each of these three functions has two variants:

 

With no argument: the function is then applied to the context node (for an example of a context node, see the example given for the lang function above).

An argument that must be a node: the function is applied to the submitted node.

 

The output of each of these six variants is a string.

 

number

Converts an input string into a number. Also converts a boolean input to a number.

 

The number function takes a node as input, atomizes the node (that is, extracts its contents), and converts the value to a decimal and returns the converted value. The only types that can be converted to numbers are booleans, strings, and other numeric types. Non-numeric input values (such as a non-numeric string) result in NaN (Not a Number).

 

There are two variants of the number function:

 

With no argument: the function is then applied to the context node (for an example of a context node, see the example given for the lang function above).

An argument that must be a node: the function is applied to the submitted node.

© 2019 Altova GmbH