I have a document which when simplified looks like this:
<?xml version="1.0"?>
<document>
<br/>
<div class="Heading">Introduction</div>
<div class="Text">Sed quis malesuada ligula. Aliquam eu felis nulla, ac tempus purus.</div>
<br/>
<div class="Heading">Background</div>
<div class="Text">Curabitur adipiscing tortor ipsum. In gravida congue tincidunt. Aliquam</div>
<br/>
<div class="Heading">Summary</div>
<div class="Text">Pellentesque consequat scelerisque urna, sit amet consequat quam lacinia ac.</div>
<br/>
</document>
What I would like to do is obtain the text of the introduction: "Sed .... puris.", so what I need is an xpath expression something like this:
(//div[@class="Text"])[0]/following-sibling::node(0)
Clearly this is rubbish; what I'm looking for is some expression that means "select the text of the div node that has a class of Text where the previous div node has a class of heading and the text of the previous node is Introduction".
I'm thinking about LINQ to Xml as well.
What XPath expression will do this?