When referencing process
list
and
map
variables
in XPath expressions, you can use other process variables for the
list’s
index
value or the map’s
key
value.
For example, a
list
variable named
listvar
holds
a collection of customer names. An
integer
variable
named
intvar
holds the index of the data item in
listvar
that
you want to retrieve. The following XPath expression returns the
data item from
listvar
:
/process_data/listvar[number(/process_data/@intvar)]
Note:
The
number
function ensures
that the data in the
/process_data/@intvar
node
is interpreted as a number. (See
number
.)
If a
string
value is used as the list index, the
expression returns the first item in the list.
A
map
variable named
mapvar
holds
customer addresses and uses the customer name as the key. The customer
name that you want the address for is stored in a
string
variable
named
stringvar
. The following XPath expression
retrieves the address from
mapvar
, which has, as
its key, the customer name stored in
stringvar
:
/process_data/mapvar[@id='/process_data/@stringvar']