[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Add namespace to element name itself

Subject: Add namespace to element name itself
From: "V.Ramkumar" <v.ramkumar@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Nov 2008 17:28:19 +0530
 Add namespace to element name itself
Hi List,

I am doing XML to XML Transformation using saxon9.

I have to add namespace to output XML name itself in transformation.

Not like, <pii xmlns="ce"> - This example found in list

I need like this <ce:pii>.

My input XML contains,
	<item-info>
		<jid>YFMIC</jid>
		<aid>1120</aid>
		<pii>S0740-0020(08)00080-4</pii>
		<doi>10.1016/j.fm.2008.04.010</doi>
		<copyright type="unknown" year="2008"/>
	</item-info>

Required output XML,
	<item-info>
		<jid>YFMIC</jid>
		<aid>1120</aid>
		<ce:pii>S0740-0020(08)00080-4</ce:pii>
		<ce:doi>10.1016/j.fm.2008.04.010</ce:doi>
		<ce:copyright type="unknown" year="2008"/>
	</item-info>

My XSL:
	<xsl:template match="*">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="pii" priority="3">
		<xsl:element name="{local-name()}" namespace="ce">
			<xsl:apply-templates select="@*|node()" />
		</xsl:element>
	</xsl:template>
ect..
	</xsl:template>

Regards,
Ramkumar

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.