私のXML構造は
<root>
<elem1>..</elem1>
<elem1>..</elem1>
*<elem1>..</elem1>*
<elem2>
<elem1>..</elem1>
<elem1>..</elem1>
¬ <elem1>..</elem1> ¬
</elem2>
</root>
root の直下の子 (* * でマーク) の最後の elem1 を選択する必要があります。
QueryPath - http://querypath.orgでそれを行いたいです。しかし、JQuery 構文も役に立ちます。
$root->find('elem1')->last();
$root->find('elem1:last);
$root->find('elem1:last-child);
上記の 3 つすべてで、¬ でマークされた elem1 が選択されます