EDN Admin
Well-known member
I want only two elements to have the name space(<Talkmessage> and <IRenvelope>). I can use <xsl:element > with namespace as attribute to create. But when I do that it creating empty namspace in the child nodes.
<u> So how do I get rid of that empty namespace? </u> I want keep the xml structure as it is, because it has to be sent to other webserver for validation purpose
I want to get the output like below
From <IRheader xmlns=" to <IRheader>
The below is the xsl code to remove all the empty elements. Can you look into it to add any code to remove
xmlns="".
<xsl:stylesheet version="1.0"
xmlns:xsl="<a title="http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform
<xslutput omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="node()|@*
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(node())]"/>
</xsl:stylesheet>
<u>The below is the xml structure I am working on</u>
<TalkMessage xmlns="<a title="http://www.sample.co.uk/CM/envelope http://www.sample.co.uk/CM/envelope http://www.sample.co.uk/CM/envelope
<EnvelopeVersion>2.0</EnvelopeVersion>
+<Header>
+<TalkDetails>
<Body>
<IRenvelope xmlns="<a title="http://www.validatio.co.uk/ http://www.validatio.co.uk/ http://www.validatio.co.uk
<IRheader xmlns=" -----------------------------------------------I need this to be <IRheader>
<TestMessage>0</TestMessage>
<Keys> <font color="#ff0000 These two elements getting empty </font>
<Key Type="STORN STORN</Key> <font color="#ff0000 namespace when I apply <xsl:elements>
</font> </Keys> <font color="#ff0000 to <TalkMessage> and <IRenvelope>.</font>
<PeriodEnd>2002-01-01</PeriodEnd> <font color="#ff0000 So I want to get rid of xmlns="" from
</font> <DefaultCurrency>GBP</DefaultCurrency> <font color="#ff0000 those two elements
</font> </IRheader>
<SDLT xmlns=" -------------------------------------------------need this to be <SDLT>
<UTRN>791555</UTRN>
<TransactionDetails>
<TransactionDescription>F</TransactionDescription>
<EffectiveDate>2006-04-05</EffectiveDate>
<RestrictionsAffecting Apply="Yes
<Details>test nine</Details>
</RestrictionsAffecting>
<ContractDate>2006-03-24</ContractDate>
<LandExchanged Exchanged="Yes
+<Address>
</LandExchanged>
<PursuantToOption>No</PursuantToOption>
+ <TaxCalculation>
</TransactionDetails>
+<LandDetail>
+<VendorDetails>
+<PurchaserDetails>
+<Supplementary>
+<SDLT4>
+<SDLT4>
</SDLT>
</IRenvelope>
</Body>
</TalkMessage>
<div class=e>
<div class=c style="margin-left:1em;text-indent:-2em <a class=b> <font face="Courier New" color="#ff0000 -</font>
View the full article
<u> So how do I get rid of that empty namespace? </u> I want keep the xml structure as it is, because it has to be sent to other webserver for validation purpose
I want to get the output like below
From <IRheader xmlns=" to <IRheader>
The below is the xsl code to remove all the empty elements. Can you look into it to add any code to remove
xmlns="".
<xsl:stylesheet version="1.0"
xmlns:xsl="<a title="http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform
<xslutput omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="node()|@*
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(node())]"/>
</xsl:stylesheet>
<u>The below is the xml structure I am working on</u>
<TalkMessage xmlns="<a title="http://www.sample.co.uk/CM/envelope http://www.sample.co.uk/CM/envelope http://www.sample.co.uk/CM/envelope
<EnvelopeVersion>2.0</EnvelopeVersion>
+<Header>
+<TalkDetails>
<Body>
<IRenvelope xmlns="<a title="http://www.validatio.co.uk/ http://www.validatio.co.uk/ http://www.validatio.co.uk
<IRheader xmlns=" -----------------------------------------------I need this to be <IRheader>
<TestMessage>0</TestMessage>
<Keys> <font color="#ff0000 These two elements getting empty </font>
<Key Type="STORN STORN</Key> <font color="#ff0000 namespace when I apply <xsl:elements>
</font> </Keys> <font color="#ff0000 to <TalkMessage> and <IRenvelope>.</font>
<PeriodEnd>2002-01-01</PeriodEnd> <font color="#ff0000 So I want to get rid of xmlns="" from
</font> <DefaultCurrency>GBP</DefaultCurrency> <font color="#ff0000 those two elements
</font> </IRheader>
<SDLT xmlns=" -------------------------------------------------need this to be <SDLT>
<UTRN>791555</UTRN>
<TransactionDetails>
<TransactionDescription>F</TransactionDescription>
<EffectiveDate>2006-04-05</EffectiveDate>
<RestrictionsAffecting Apply="Yes
<Details>test nine</Details>
</RestrictionsAffecting>
<ContractDate>2006-03-24</ContractDate>
<LandExchanged Exchanged="Yes
+<Address>
</LandExchanged>
<PursuantToOption>No</PursuantToOption>
+ <TaxCalculation>
</TransactionDetails>
+<LandDetail>
+<VendorDetails>
+<PurchaserDetails>
+<Supplementary>
+<SDLT4>
+<SDLT4>
</SDLT>
</IRenvelope>
</Body>
</TalkMessage>
<div class=e>
<div class=c style="margin-left:1em;text-indent:-2em <a class=b> <font face="Courier New" color="#ff0000 -</font>
View the full article