This is what XSLT is for.
You can run XSLT transforms from the command line with xsltproc (apt-get xsltproc)
XSLT language, is a topic of its own, but it is a functional language very much like lisp, except task-specific to transforming xml documents.
On 2018-09-11 11:48 PM, der.hans wrote:
> moin moin,
>
> Actually, sgrep with sed for XML :).
>
> I have a chunk of XML I would like to transform. Any suggestions on how to
> do the following from the command line?
>
> ----
>
> office:value-type="string">
> blah content stuff
>
> office:value-type="string">
>
>
>
>
> ----
>
> I would like to make the first cell span 3 columns and wipe out the second
> cell.
>
> The graphical tool essentially turns it into the following.
>
> ----
>
> table:number-columns-spanned="3" office:value-type="string">
> blah content stuff
>
>
>
> ----
>
> A new style, Table1.A2, is introduced. That cell is spanned across three
> columnts. The table:table-cell object for the second cell is removed.
>
> I can do this with sed, but that invites XML issues. Also, there are some
> more complex changes I want to make.
>
> ciao,
>
> der.hans