[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Copying nodes from source XML to the result tree


Subject: [xsl] Copying nodes from source XML to the result tree
From: Abhijit Junnare <mavlaabhi@xxxxxxxxx>
Date: Tue, 7 Oct 2003 13:43:42 -0700 (PDT)

I am trying to copy nodes from the source XML to the
output generated using XSL. 
My problem is that all the nodes that I copy have the
namespace attribute attached with them. I am wondering
if there is any alternative to get rid of the
namespace attribute.
Here is my sample code.

INPUT XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="temp.xsl"?>
<AssembleRequest xmlns="www.myhome.com">
	<Transaction>
		<TransactionID>111</TransactionID>
	</Transaction>
</AssembleRequest>

STYLEHSEET

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:temp="www.myhome.com"
>

<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
			<xsl:apply-templates
select="temp:AssembleRequest"/>
	</xsl:template>

	<xsl:template match="temp:AssembleRequest" >
		<xsl:element name="TransData">
		<xsl:apply-templates/>		
		</xsl:element>
	</xsl:template>
	
	<xsl:template match="temp:Transaction">
		<xsl:copy/>
		<xsl:copy-of select="node()"/>		
	</xsl:template>

OUTPUT
<?xml version="1.0" encoding="UTF-8"?>
<TransData>
<Transaction xmlns="www.myhome.com" />
<TransactionID
xmlns="www.myhome.com">111</TransactionID>
</TransData>

Is there a way to get rid of the xmlns attribute on
the Trasaction and TransactionID elements.
Also is there a FAQ on copying source nodes to the
result tree using XSL. 
Any help is appreciated.
Thanks


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml