Preserve the attributes of a document tag



I have this XML below that I use as input



<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="some:urn" xmlns:xsi="http://ift.tt/ra1lAU">
<People>
<Personal>
<Name>Juan Dela Cruz</Name>
<Age>21</Age>
</Personal>
<Employment>
<Start>21-02-2014</Start>
<EmpNumber>1234</EmpNumber>
</Employment>
</People>
</Document>


ANd when I try to transofrm it using this XSLT:



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
<xsl:copy-of select="Document"/>
<Document xmlns="some:urn" xmlns:xsi="http://ift.tt/ra1lAU">
<xsl:apply-templates select="Document/People" />
</Document>
</xsl:template>

<xsl:template match ="People">
<People>
<xsl:apply-templates select="Personal" />
<xsl:apply-templates select="Employment" />
</People>
</xsl:template>

<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


I only get this result:



<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="some:urn" xmlns:xsi="http://ift.tt/ra1lAU" />


Anyone have an Idea what is wrong with my XSLT, I am using Visual Studio to transform the XML


TIA :)


No comments:

Post a Comment