I'm using pQuery (a Perl port of jQuery) to select elements and retrieve text from a HTML-document.
Consider the following markup:
<x>
<y>code1</y>
<z>stuff</z>
<y>code2</y>
<z>foobar</z>
</x>
And the following pQuery code:
my $target_value = pQuery($markup)->find($pquery_selector)->text;
I'm trying to formulate $pquery_selector
so that it matches <z>foobar</z>
in the markup above using the following rule: find the z
-element that follows after a y
-element which has a body containing "code2"
. While this is possible using jQuery I'm not sure that the pQuery syntax is powerful enough to handle such an expression.
Is this type of selection possible using the pQuery syntax?