I am using XSLT 1.0. I have the following xml input:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<groupLOB>M1 M2 M3 M4</groupLOB>
</root>
The tag <groupLOB>
has the value M1 M2 M3 M4
Now I want to split the value into multiple strings and store them unde based on the delimiter 'space'i.e. ' '. My end xml should be as below:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<One>M1</One>
<Two>M2</Two>
<Three>M3</Three>
<Four>M4</Four>
</root>
I tried with the following XSLT, but it's not giving me the required output, i.e. I am not sure how to move the split values under the new tags.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" />
<xsl:template match="/*">
<xsl:value-of select="translate(., ' ', '
')" />
</xsl:template>
</xsl:stylesheet>
Anybody has any idea on how to do that?