I am looking for a solution to frame xpath logic to compare attributes.
<menucontainer id="menu1" op="o3" indicator="highlight">
<menubox>
<menutitle>TITLE</menutitle>
<menuoptionlist>
<menuoption id="o1">Select a path from below :</menuoption>
<menuoption id="o2">IMAGE1</menuoption>
<menuoption id="o3">IMAGE2</menuoption>
<menuoption id="o4">IMAGE3</menuoption>
<menuoption id="o5">IMAGE4</menuoption>
<menuoption id="o6">IMAGE5</menuoption>
</menuoptionlist>
</menubox>
</menucontainer>
Here I want to compare menucontainers op value (op="03") against the menuoption id's.So here the ideal match would be IMAGE2. And I would be highlighting the IMAGE2 in red colour.
I tried //menublock/menucontainer/@op = //menublock/menucontainer/menuoptionlist/menuoption/@id
but it is not dynamic.It checks first result and applies the same result everywhere.pls help in framing the xpath .
To return the node
menuoptionwhere the value is IMAGE2, based on the menuoption attributeidbeing equal to the menucontainer attributeopyou can use the following XPath Selector//menucontainer/menubox/menuoptionlist/menuoption[@id=../../../@op]The
../goes up a level. W3schools XPath SyntaxXPathFiddle