Input xml data looks like this:
<Item key="">
<Adress>
<Template key="01,09-10,21">
<Channel>
<Template key="1-3"/>
</Channel>
</Template>
</Adress>
</Item>
First, I wrote an Identity template that copies all the tags and their attributes sequentially to the output xml (the input and output file are the same). Then I renamed the 'Template' tag to 'Item' so the stylesheet looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Template">
<Item>
<xsl:apply-templates select="@*|node()"/>
</Item>
</xsl:template>
</xsl:stylesheet>
How do I write the style file so that the output xml looks like this:
<Item key="">
<Adress>
<Item key="01">
<Channel>
<Item key="1"/>
<Item key="2"/>
<Item key="3"/>
</Channel>
</Item>
<Item key="09">
<Channel>
<Item key="1"/>
<Item key="2"/>
<Item key="3"/>
</Channel>
</Item>
<Item key="10">
<Channel>
<Item key="1"/>
<Item key="2"/>
<Item key="3"/>
</Channel>
</Item>
<Item key="21">
<Channel>
<Item key="1"/>
<Item key="2"/>
<Item key="3"/>
</Channel>
</Item>
</Adress>
</Item>
XSLT version 1.0, Visual Studio 2017