[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Element name Change for a node
Please try this stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/address"> <address> <xsl:apply-templates /> </address> </xsl:template> <xsl:template match="*[../self::address]"> <xsl:element name="{concat('US_', local-name())}"> <xsl:value-of select="." /> </xsl:element> </xsl:template> </xsl:stylesheet> This when applied to XML: <address> <streetAddress>123 First Street</streetAddress> <city>Sometown</city> <state>CA</state> <zip>12345</zip> <province/> <country>USA</country> </address> Produces output: <?xml version="1.0" encoding="UTF-8"?> <address> <US_streetAddress>123 First Street</US_streetAddress> <US_city>Sometown</US_city> <US_state>CA</US_state> <US_zip>12345</US_zip> <US_province/> <US_country>USA</US_country> </address> On 9/14/06, Senthilkumaravelan Krishnanatham <senthil@xxxxxxxxx> wrote:
-- Regards, Mukul Gandhi http://gandhimukul.tripod.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|