Subject: Re: [xsl] [XSLT 1.0] Replace namespace prefixes? From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> Date: Thu, 24 Dec 2009 22:48:14 +0530 |
Hi Roger, I found the solutions presented below, to work. On Thu, Dec 24, 2009 at 10:09 PM, Costello, Roger L. <costello@xxxxxxxxx> wrote: > Into this: > > B B <bk:book xmlns:bk="http://www.book.org"> > B B B B <bk:title>The Origin of Wealth</bk:title> > B B B B <bk:author>Eric D. Beinhocker</bk:author> > B B B B <bk:date>2006</bk:date> > B B B B <bk:ISBN>1-57851-777-X</bk:ISBN> > B B B B <bk:publisher>Harvard Business School Press</bk:publisher> > B B B B <bk:cost currency="USD">29.95</bk:cost> > B B </bk:book> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bk="http://www.book.org" version="1.0"> <xsl:output method="xml" /> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="/"> <xsl:element name="bk:{local-name(*)}" xmlns:bk="http://www.book.org"> <xsl:copy-of select="*/@*" /> <xsl:apply-templates select="*/node()" /> </xsl:element> </xsl:template> <xsl:template match="*"> <xsl:element name="bk:{local-name()}"> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:element> </xsl:template> </xsl:stylesheet> > Or this: > > B B <book xmlns="http://www.book.org"> > B B B B <title>The Origin of Wealth</title> > B B B B <author>Eric D. Beinhocker</author> > B B B B <date>2006</date> > B B B B <ISBN>1-57851-777-X</ISBN> > B B B B <publisher>Harvard Business School Press</publisher> > B B B B <cost currency="USD">29.95</cost> > B B </book> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.book.org" exclude-result-prefixes="" version="1.0"> <xsl:output method="xml" /> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="/"> <xsl:element name="{local-name(*)}" xmlns="http://www.book.org"> <xsl:copy-of select="*/@*" /> <xsl:apply-templates select="*/node()" /> </xsl:element> </xsl:template> <xsl:template match="*"> <xsl:element name="{local-name()}"> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:element> </xsl:template> </xsl:stylesheet> -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [XSLT 1.0] Replace namespace , Costello, Roger L. | Thread | RE: [xsl] [XSLT 1.0] Replace namesp, Costello, Roger L. |
RE: [xsl] [XSLT 1.0] Replace namesp, Scott Trenda | Date | RE: [xsl] [XSLT 1.0] Replace namesp, Costello, Roger L. |
Month |