not-exists

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions > Function Library Reference > core | sequence functions >

not-exists

Returns false if the node exists, else returns true.

fn-notexist

The example below shows how you can use the not-exists function to map nodes that do not exist in one of a pair of source files.

 

What this mapping does:

 

Compare the nodes of two source XML files
Filter out the nodes of the first source XML file, that do not exist in the second source XML file
Map only the missing nodes, and their content, to the target file.

miss-node1

The two XML instance files are shown below, the differences between them are:

 

a.xml (left) contains the node <b kind="3">, which is missing from b.xml.
b.xml (right) contains the node <b kind="4"> which is missing from a.xml.

 

miss-node1a miss-node1b

 

The equal function compares the kind attribute of both XML files and passes the result to the filter.
A not-exists function is placed after the initial filter, to select the missing nodes of each of the source files.
The second filter is used to pass on the missing node and other data only from the a.xml file to the target.

 

The mapping result is that the node missing from b.xml, <b kind="3">, is passed on to the target component.

miss-node1c


© 2019 Altova GmbH