Reputation: 780
Given this XML data:
<PubmedArticle>
<MedlineCitation Status="PubMed-not-MEDLINE" Owner="NLM">
<PMID Version="1">31666891</PMID>
<Article PubModel="Electronic-eCollection">
<Journal>
<ISSN IssnType="Print">1640-5544</ISSN>
<Title>Journal of human kinetics</Title>
<ISOAbbreviation>J Hum Kinet</ISOAbbreviation>
</Journal>
<ArticleTitle>Relationships between the Expression of the <i>ACTN</i>3 Gene and Explosive Power of Soccer Players.</ArticleTitle>
</Article>
</MedlineCitation>
<MedlineCitation Status="PubMed-not-MEDLINE" Owner="NLM">
<PMID Version="1">31666892</PMID>
<Article PubModel="Electronic-eCollection">
<Journal>
<ISSN IssnType="Print">1640-5544</ISSN>
<Title>Journal of human kinetics</Title>
<ISOAbbreviation>J Hum Kinet</ISOAbbreviation>
</Journal>
<ArticleTitle>Cardiovascular and Perceived Effort in Different Head-Out Water Exercises: Effect of Limbs' Action and Resistance Equipment.</ArticleTitle>
</Article>
</MedlineCitation> </PubmedArticle>
How can I get the text in the node <ArticleTitle></ArticleTitle>
that matches the text in the node <PMID></PMID>
that contains '31666891', ie
Text='Relationships between the Expression of the <i>ACTN</i>3 Gene and Explosive Power of Soccer Players'
I've tried
//PMID[text()='31666891']/following::ArticleTitle[1]
But it seems messy ..
Upvotes: 0
Views: 35
Reputation: 29022
You can use
//PMID[text()='31666891']/../Article/ArticleTitle
or, another possibility, this
//MedlineCitation[PMID='31666891']/Article/ArticleTitle
Upvotes: 1