Subsequence Search
I don't know how extensible this is, but it works for your case,
Cases[list,
p[args:PatternSequence[___, a, _p, q, ___]] :> SequenceCases[
{args},
{a, p[x_, y_], q} :> {x, y}
],
Infinity
]
(* {{{1, 2}, {3, 4}, {5, 6}}} *)
This also works for your list, but like Jason B, I don't that is will be applicable to your XML problem.
Cases[Partition[List @@ list[[1]], 3, 1], {a, u : p[_, _], q} -> u]
{p[1, 2], p[3, 4], p[5, 6]}