|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Copy-of & New Namespace prefix
Hi Christopher,
Your expected output is not XML as the prefix foo is not bound. If for instance foo points to the http://www.example.com/foo then the following stylesheet will do what you want: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://www.example.com/foo"> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <!-- matches elements --> <xsl:template match="*"> <!-- creates an element with the same local name but in the foo namespace--> <xsl:element name="foo:{local-name()}" namespace="http://www.example.com/foo"> <xsl:apply-templates select="node() | @*"/> </xsl:element> </xsl:template> </xsl:stylesheet>
Woods, Christopher wrote: Hello,
|
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
|






