open 903926.xml ; map :i {s/(.*)/[$1]/} //mml:mi[text()!="s"] ; # wrap non-s in square brackets map "..." //mml:mi[text()="s"] ; # replace s with ...