Please see the below XML. In the XML the name element is a self closing empty tag. I need to add a text value to this name element tag. This chunk of XML code might be repeated any number of times in the whole XML.
<participant typeCode="LOC">
<participantRole classCode="SDLOC">
<id extension="00000000-0000-0000-0000-000000000000" root="1.0"/>
<addr nullFlavor="UNK"/>
<playingEntity>
<name/>
</playingEntity>
</participantRole>
</participant>
Expected Output: Need to add the UNK text value for the self closing empty name element tag.
<participant typeCode="LOC">
<participantRole classCode="SDLOC">
<id extension="00000000-0000-0000-0000-000000000000" root="1.0"/>
<addr nullFlavor="UNK"/>
<playingEntity>
<name>UNK</name>
</playingEntity>
</participantRole>
</participant>
I need an XSLT script to achieve this requirement.
Thanks,
You need an identity transformation template:
plus a template for the name tag:
Wrap this within the stylesheet tag, and add an xml header: