Expand my Community achievements bar.

xpath with another xpath between single quotes

Avatar

Level 6

Hello,

Im using an xpath expression to find a node in a xml variable. In this xpath I need to equal the text part of the resolved node to the value returned from the xpath from another xml variable. The value returned from the second xpath needs to be between single quotes in the first xpath, but it is not working. I already tried this:

/path_to_xml1/root_node/node[text = '/path_to_xml2/root_node/node']

string(/path_to_xml1/root_node/node[text = '/path_to_xml2/root_node/node'])

string(/path_to_xml1/root_node/node[text = 'string(/path_to_xml2/root_node/node')])

thank you

4 Replies

Avatar

Level 10

When you say : "...I need to equal the text part of the resolved node", are you talking about a text attribute of the node or just the value of that node?

If it's just the value of the node then you should just use /path_to_xml1/root_node/node /path_to_xml2/root_node/node

Jasmin

Avatar

Level 6

Hi,

Im trying to get the value of a node attribute that I will select based on the node value. The node value it is given from another process variable.

Thank you

Avatar

Level 10

Try the following:

/path_to_xml1/root_node/node[text = 'string(/path_to_xml2/root_node/node)']

Jasmin

Avatar

Level 9

Hi

I haven't tried it, but I think that might be:

/path_to_xml1/root_node/node[text = string(/path_to_xml2/root_node/node)]

i.e. without the quotes.

Please let us know if either approach works.

Howard