Skip to content
Advertisement

Split string in xml

I have xml file which contains data .

JavaScript

I want to split only FATURANO Like that

6-R-7

and

4825

And this “4825” should have different name.

JavaScript

I Need convert xml data like that but if u answer me only with first question how to split string correctly i will do other transpormation

Advertisement

Answer

With single xmlstarlet expression:

JavaScript
  • ededit mode

  • -xxpath expression

  • -a – append element

  • -t – the type of the appended element (in edit mode)

  • -n – the name of the appended element

  • -v – the value of the updated/appended element


The output:

JavaScript
Advertisement