Given the following XML, I want to select every potential element between "First heading" and "Second heading", these heading elements excluded. I am not sure what version of XSLT I can use (I'm modifying a sheet run by a proprietary app...)
<body>
<h1 class="heading1">Some title</h1>
<p class="bodytext">Some text.</p>
<p class="sectiontitle">First heading</p>
<p class="bodytext">Want that.</p>
<div>
<p class="bodytext">Want that too!</p>
</div>
<p class="sectiontitle">Second heading</p>
<p class="bodytext">Some text</p>
<p class="sectiontitle">Third heading</p>
...
</body>
Expected:
<p class="bodytext">Want that.</p>
<div>
<p class="bodytext">Want that too!</p>
<div>
I know that p class="sectiontitle">First heading</p>
:
- will always be of the
sectiontitle
class. - will always contain
First heading
. - does not have to be first p of this class, its position is unknown.
I also now that I will stop once I find <p class="sectiontitle">Could be any title</p>
(so based on class only)
I have seen the other similar posts about this kind of problems, and I still can't crack my case...
What I have tried, amongst other things:
//*[(preceding-sibling::p/text()="First heading") and (not(following-sibling::p[@class="sectiontitle"]))]