I am given the following XML document:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Line>
<Segments>
<Segment>
<Inputs>
<Input id="718">
<Attribute id="1300">ABC</Attribute>
<Attribute id="1" >DEF</Attribute>
<Attribute id="2">GHI</Attribute>
</Input>
</Inputs>
</Segment>
<Segment>
<Inputs>
<Input id="718">
<Attribute id="1300">ABC2</Attribute>
<Attribute id="1" >DEF</Attribute>
<Attribute id="2">GHI2</Attribute>
</Input>
</Inputs>
</Segment>
</Segments>
</Line>
I would like to access DEF. Using xmlstarlet:
xml sel -t -v "//Input[@id=718][1]/Attribute[@id=1]" query-testing.xml
I get the result "DEF" (the original document had many input nodes with id "718", that's why I added "[1]" after "[@id=718]").
However, invoking XQueryExtractor with "//Input[@id=718][1]/Attribute[@id=1]" gives the result
<Attribute id="1">DEF</Attribute>
Of course I can modify that answer to get the desired DEF, but I am just wondering if I didn't configure the transformer correctly.
Attached is a screenshot of my configuration and the workbench: