How to pull an xml attribute when using PREP_PROCESS_VAR_XML

Discussion created by Darren_Sniezak_40 on Jun 6, 2016
The common use of PREP_PROCESS_VAR_XML will pull the values from within XML tags, but if you are in a situation where you need to take the attributes of a XML tag instead, you can do this with utilizing XPATH in the value of the variable.

For example, if you had an XML Variable with a key of UserInterface and a value of:
<connection name="test" system="test"><cp ip="" port="2217"/><cp ip="" port="2218"/><cp ip="" port="2219"/><cp> </cp><wp test="test"></wp></connection> 

You could use: 
:SET &HND# = PREP_PROCESS_VAR_XML(VARA.XML,"UserInterface","/connection/cp/@port") 
: P &LINE# 

To return: 
U00020408 2217 
U00020408 2218 
U00020408 2219