I want to change an input xml file to a given format.
My input xml is:
<Syncaaa xmlns="http://www.w3.org/TR/html4/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/TR/html4/ Syncaaa.xsd" releaseID="9.2" versionID="2.0.1">
<eee>
<Sender>
<BOD>qwqqs</BOD>
<ID>1222</ID>
<Code>Success</Code>
</Sender>
</eee>
<ddd>
<bbb>
<EntityId>100</EntityId>
</bbb>
<aaa type="xoxo">
<Item>
<Status>true</Status>
<zzzz>O</zzzz>
</Item>
<Item>
<Status>false</Status>
<zzzz>1</zzzz>
</Item>
</aaa>
</ddd>
</Syncaaa>
From above xml, I want to extract below xml part.
<aaa type="xoxo">
<Item>
<Status>true</Status>
<zzzz>O</zzzz>
</Item>
<Item>
<Status>false</Status>
<zzzz>1</zzzz>
</Item>
</aaa>
And, tag names of the extracted xml should be changed as below.
<ddd>
-><Updatedaaa>
<Item>
-><UpdateItem>
<Status>
-><UpdatedStatus>
<zzzz>
-><Updatedzzzz>
Excepted output is like below.
<Updatedaaa>
<UpdateItem>
<UpdatedStatus>true</UpdatedStatus>
<Updatedzzzz>0</Updatedzzzz>
</UpdateItem>
<UpdateItem>
<UpdatedStatus>false</UpdatedStatus>
<Updatedzzzz>1</Updatedzzzz>
</UpdateItem>
</Updatedaaa>
I tried to do that task using below xsl file.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="ddd">
<UpdatedItem>
<xsl:apply-templates select="@*"/>
<UpdatedStatus>
<xsl:apply-templates select="Status"/>
</UpdatedStatus>
<Updatedzzzz>
<xsl:apply-templates select="zzzz"/>
</Updatedzzzz>
</UpdatedItem>
</xsl:template>
</xsl:stylesheet>
But it didn't work with this xsl file. Please help me to identify the issue.
Thanks,