I'm working with some XML that keeps all its data in attributes. I'm needing to extract that for processing the data. So we have something like:
<data>
<level1>
<level2 att1="1">
<level 3>
<level 4 att2="a" att3="b" att4="c" />
</level 3>
<level 3>
<level 4 att2="1" att3="2" att4="3" />
</level 3>
</level 2>
<level 2 att1="2">
So i'm wanting all attributes from the level 4 entries and their values, but ONLY from level2 entries where att1 = 1. I'm new to XPath, so I haven't worked it out yet. So far, the best I've come up with is:
/data/level1/level2[@att1='1']/level3/level4[@*]
but that is returning empty data. Any help would be appreciated.