Input XML
<pageMeta>
<trail target="/">SAIR Home</trail>
<trail target="/handle/10862/1">SEAFDEC Aquaculture Department</trail>
<trail target="/handle/10862/46">SEAFDEC/AQD Publications</trail>
<trail target="/handle/10862/85">Institutional and Meeting Reports</trail>
<trail target="/handle/10862/699">Institutional Reports</trail>
<trail target="/handle/10862/527">Annual Reports</trail>
</pageMeta>
Using select="pageMeta/trail[@target][last()]
, I get the Annual Reports value. How can I get the value of the last @target
attribute which is /handle/10862/527
?
Thanks in advance.
You can simply put the attribute name as the last step of the XPath expression to return the attribute :
select="pageMeta/trail[@target][last()]/@target"
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments