Reputation: 33
I have the following code:
<include>
<fallback>
<title>Content</title>
</fallback>
</include>
<include>
<fallback>
<title>Content</title>
</fallback>
</include>
<include> <-- I want this.
<fallback>
<title>Content</title>
</fallback>
</include>
<adhoc>
<title>Content</title>
</adhoc>
<include>
<fallback>
<title>Content</title>
</fallback>
</include>
I need to find the third <include>
because it has <adhoc>
as its direct following-sibling. Is there away to find this with XPath?
Upvotes: 3
Views: 53
Reputation: 89285
"I need to find the third
<include>
because it has<adhoc>
as it's direct following-sibling."
This requirement can be translated to XPath as follow :
//include[following-sibling::*[1][self::adhoc]]
Upvotes: 4