Hi Experts!
Can you help suggest how I can insert Returned tag(under secondary) on the Inventory tag(under Primary)
and then output only the Profile and all its aattributes under Primary as below.
Input:
<MergedProfile>
<Primary>
<Profile>
<Primary>
<Books></Books>
<Magazines></Magazines>
</Primary>
<Inventory action="mod">
<Borrowed action="mod">
<January>24</January>
</Borrowed>
</Inventory>
</Profile>
</Primary>
<Secondary>
<Profile>
<Inventory action="mod">
<Returned>
<January>7</January>
</Returned>
</Inventory>
</Profile>
</Secondary>
</MergedProfile>
Output Desired:
<Profile>
<Primary>
<Books></Books>
<Magazines></Magazines>
</Primary>
<Inventory action="mod">
<Borrowed action="mod">
<January>24</January>
</Borrowed>
<Returned action="del">
<January>7</January>
</Returned>
</Inventory>
</Profile>
I have the below code playing into - it inserts but copying all.
Have changed the template match and apply-templates to /MergedProfile/Primary but it either returns nothing or everything
<xsl:stylesheet version="1.0">
<xsl

utput method="xml" version="1.0"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="/MergedProfile/Primary/Profile/Inventory">
<xsl:element name="Returned">
<xsl:attribute name='action'>del</xsl:attribute>
<xsl:for-each select="../../../Secondary/Profile/Inventory/Returned/January">
<xsl:element name="January">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Thanks! Appreciate your help. Can't find any sites related to this...