I have some data in an XML element that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<payload>
<set>
<month>JAN,FEB,MAR</month>
<season>Season1</season>
<productId>ABCD</productId>
</set>
</payload>
The thing i am interested in is to split the comma seperated string into whole new set tags like:
<payload>
<set>
<month>JAN</month>
<season>Season1</season>
<productId>ABCD</productId>
</set>
</payload>
<payload>
<set>
<month>FEB</month>
<season>Season1</season>
<productId>ABCD</productId>
</set>
</payload>
<payload>
<set>
<month>MAR</month>
<season>Season1</season>
<productId>ABCD</productId>
</set>
</payload>
How would it be possible to do this with an XSLT?
Using XSLT 1.0 you have to use a recursive call to a named template to split the string, here is a possible solution: