XMLstarlet to fix image tags and replace path for images
1
vote
0
answers
232
views
I have multiple .XHTML files in the folder. The top declaration part is as follows:
First, I don't want alter top head part.
I want process files in batch and fix two things,
1) terminate image end tags properly
` tags. 2) replace path in all images (preserving name), i.e. from
'/>'
, same for ` and
` tags. 2) replace path in all images (preserving name), i.e. from

to

Tried xmlstarlet (v1.6.1), xmlstarlet fo --recover --html file.xhtml
but it alters top declaration part, adding extra stuff at the top:
Also warns about invalid tag
file.xhtml:8.54: Tag section invalid
^
what is correct commands? First I need 'dry run' to see changes, if OK then apply in place.
Asked by minto
(575 rep)
Sep 27, 2021, 09:19 PM
Last activity: Sep 27, 2021, 10:07 PM
Last activity: Sep 27, 2021, 10:07 PM