I want to remove the namespace "xmlns" In my output xml generated .Please help.
Below is my Input XML :
Code:
<Sample xmlns="http://tempuri.org/Container.xsd">
<header messageId="da44a350" location="P" containerId="" />
<Product Ref="ZF1234567890">
<container_cd />
<salesOrder />
<salesLine />
<width>0</width>
<partNumber />
</Product>
</Sample>
And my output should look like this :
Code:
<Envelope>
<GHeader>
<TimeStamp>2013-07-16T11:00:00</TimeStamp>
<MessageID>da44a350</MessageID>
</GHeader>
<Sample>
<header messageId="da44a350" location="P" containerId="" />
<Product Ref="ZF1234567890">
<container_cd />
<salesOrder />
<salesLine />
<width>0</width>
<partNumber />
</Product>
</Sample>
</Envelope>
The XSLT I used to transform is below :
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
exclude-result-prefixes="fo xs fn xdt my"
xmlns:my="http://tempuri.org/Container.xsd" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/my:Sample">
<xsl:message>
<Envelope>
<GHeader>
<TimeStamp>
<xsl:value-of select="format-dateTime(current-dateTime(), '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]')" />
</TimeStamp>
<MessageId>
<xsl:value-of select="//my:Sample/my:header/@messageId"/>
</MessageId>
</GHeader>
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:copy-of select="//my:Sample/node()"/>
</Envelope>
</xsl:message>
</xsl:template>
</xsl:stylesheet>
And the Output received is :
Code:
<Envelope>
<GHeader>
<TimeStamp>2013-07-16T11:00:00</TimeStamp>
<MessageID>da44a350</MessageID>
</GHeader>
<Sample xmlns: "http:=//tempuri.org/Container.xsd">
<header messageId="da44a350" location="P" containerId="" />
<Product Ref="ZF1234567890">
<container_cd />
<salesOrder />
<salesLine />
<width>0</width>
<partNumber />
</Product>
</Sample>
</Envelope>
How do I remove the name space xmlns: "http:=//tempuri.org/Container.xsd" from the node