I want to find the value of the presenter if the value of the title is 'This is a title'
<AXFRoot>
<MAObject type="default" md>
<GUID dmname="">ID00001</GUID>
</MAObject>
<MVAttribute type="RUNDOWN" index="0" attribute="RUNDOWN" md objectid="ID00001">
<Meta name="TITLE" format="string">This is a title</Meta>
<Meta name="AIRDATE" format="string">20201001194131</Meta>
<Meta name="PAGE_NUMBER" format="string">01</Meta>
<Meta name="PRESENTER" format="string">abcdef</Meta>
<Meta name="AUDIO_TIME" format="string">0</Meta>
<Meta name="TOTAL_TIME" format="string">0</Meta>
<Meta name="ARCHIVE" format="string">0</Meta>
<Meta name="MOS_TITLE" format="string" />
</MVAttribute>
<MVAttribute type="RUNDOWN" index="1" attribute="RUNDOWN" md objectid="ID00001">
<Meta name="TITLE" format="string">This is another title</Meta>
<Meta name="AIRDATE" format="string">20201001194131</Meta>
<Meta name="PAGE_NUMBER" format="string">01</Meta>
<Meta name="PRESENTER" format="string">ghijkl</Meta>
<Meta name="AUDIO_TIME" format="string">0</Meta>
<Meta name="TOTAL_TIME" format="string">0</Meta>
<Meta name="ARCHIVE" format="string">0</Meta>
<Meta name="MOS_TITLE" format="string" />
</MVAttribute>
</AXFRoot>
So far I got
//AXFRoot/MVAttribute[@type='RUNDOWN']/Meta[@name='TITLE' and text()='This is a title']
but this only gives me the title element, not the value of the presenter. What do I need to add?
CodePudding user response:
You were almost there:
//AXFRoot/MVAttribute[@type='RUNDOWN']
/Meta[@name='TITLE' and text()='This is a title']
/../Meta[@name='PRESENTER']
or
//AXFRoot/MVAttribute[@type='RUNDOWN']
[Meta[@name='TITLE' and text()='This is a title']]
/Meta[@name='PRESENTER']