How can I use xmlstarlet to query a tag for two attribute values?
2
votes
2
answers
5218
views
Example:
I'd like to select @id="cover"
and media-type="image/*"
and retrieve @href
.
My current "solution" seems to be...
xmlstarlet sel -t -m "//_:item[@id='$opf_cover_name']" -v @href -o '|' -v @media-type -n file.xml
...followed by some extremely messy splitting around the '|' character of the output.
Does xmlstarlet have a substring function?
$ xmlstarlet --version
Version = 1.6.1
compiled against libxml2 2.9.4, linked with 20904
compiled against libxslt 1.1.29, linked with 10132
Asked by Jeremy Boden
(1344 rep)
Nov 28, 2021, 11:01 PM
Last activity: Sep 24, 2024, 05:57 PM
Last activity: Sep 24, 2024, 05:57 PM