I would like to iterate over many xml files to fix outdated configuration entries by getting all matches and replacing then in a second step every entry by updated strings (multiline scripts in this case).
I'm aware how to query/select and print element's values using XPath with xmlstarlet e.g.
xmlstarlet sel -t -v '//hudson.tasks.Shell/command' $xml
or how to list all the XPaths using
xmlstarlet el -a $xml
Is there a way to output a list of valid XPaths expressions for every match to use this XPath string later to update the value in the second step? e.g.
maven2-moduleset/postbuilders/hudson.tasks.Shell[1]/command
maven2-moduleset/postbuilders/hudson.tasks.Shell[2]/command
The only solution I found for now was to count the paths from el output and then to loop over them by index (using bash).