A global variable is an alias association for a type and its value. Instead of using the function nodeValue("xpath") you may then use the global variable instead.
As an example. If you want to calculate a price like this:
nodeValue("/purchaseOrder/item/quantity") * nodeValue("/purchaseOrder/item/price")
You may use the following syntax after you have defined two global variables:
quantity * price
To define a variable you need to specify the following:
Parameter | Description | Example |
---|---|---|
xpath | XPath to address a node or a node list. Every referenced node will become a variable definition. If you address nodes with an xpath selector like '//' or '//*' be sure that the node names are unique. Otherwise specify a name/value tuple where the name comes from another node. | /purchaseOrder/item/quantity /item//* //quantity |
name | Defines the name and its value holder (optional) tag name (comma separated).
Note: If you want the name or the value to be interpreted as a child node/child value you need to specify the variable as isDynamic = true. | myName myName,myValue |
namePrefix (optional) | You may prefix all the var names if you like. This is optional but very powerfull if you know about duplicate node names. | nl-1 nl-2 |
isDynamic | If you like to take the var name (and/or its value) from another node, be sure you mark the var as 'isDynamic'. Default is false. If false the name of the variable is eather a fix name or if the name is empty the tag name of the target node will be taken. | true/false |
<var isDynamic="true"> <name>../../../config/type/@name</name> <condition>nodeLabel(choosenNode("../../../config/type")) != "raster"</condition> <xpath>//page//element/value/simple/text()</xpath> </var> <var isDynamic="true"> <name>./config/@name</name> <xpath>//page/UNNAMED1/group</xpath> </var> <var isDynamic="true"> <name>../../../config/type/@name</name> <namePostfix>formula:pos()</namePostfix> <xpath>//page//element/value/list/sl</xpath> </var> <var isDynamic="true"> <name>formula:"../../../../config/type/table/column[" + integer(subStringAfter(nodeName("."),,1)) + "]/@name"</name> <namePrefix>formula:nodeValue("../../../../config/type/@name")</namePrefix> <namePostfix>formula:pos()</namePostfix> <xpath>//page//element/value/list/*/*[starts-with(local-name(), 'c')]</xpath> </var>