Reputation: 1401
given this xml as example:
<epp:phrases xmlns="http://www.w3.org/1999/xhtml" xmlns:epp="http://eprints.org/ep3/phrase" xmlns:epc="http://eprints.org/ep3/control">
<epp:phrase id="Plugin/Screen/BatchEdit:title">Batch Editing Tool</epp:phrase>
<epp:phrase id="Plugin/Screen/BatchEdit:action:edit">Apply Actions</epp:phrase>
<epp:phrase id="Plugin/Screen/BatchEdit:edit_title">Modify Records</epp:phrase>
<epp:phrase id="Plugin/Screen/BatchEdit:remove_title">Remove all Records</epp:phrase>
<epp:phrase id="Plugin/Screen/BatchEdit:remove_help">Destroy all matching items. Once destroyed the items will be gone forever - this action <b>cannot be undone</b>!</epp:phrase>
<epp:phrase id="Plugin/Screen/BatchEdit:confirm_remove">Are you absolutely sure you want to destroy all these items (this action cannot be undone)?</epp:phrase>
</epp:phrases>
how i can use xmlstarlet to obtain the inner value searching the @id attribute?
so if i search "Plugin/Screen/BatchEdit:remove_title" i want the text "Remove all Records"
other command line scripts you suggest me to use? thank you
Upvotes: 2
Views: 1228
Reputation:
Probably something like this:
//epp:phrase[@id="Plugin/Screen/BatchEdit:remove_title"]/text()
Edit:
$ xmlstarlet sel -t -v '//epp:phrase[@id="Plugin/Screen/BatchEdit:remove_title"]/text()' x.xml
Upvotes: 3