Re: [xsl] transforming without outputting original namespace

Subject: Re: [xsl] transforming without outputting original namespace
From: Kamal Bhatt <kbhatt@xxxxxxxxx>
Date: Mon, 05 Feb 2007 08:23:14 +1100
Sam Carleton wrote:
Thanks to David's help, I am now transforming xml that has a
namespace.  My target is a piece of HTML, so I would prefer if the
namespace was not in the output, which it is:

<div xmlns="http://www.photoparata.com/events.xsd";
xmlns:p="urn://www.photoparata.com/events.xsd" id="titlebar"/>

How do I go about getting rid of it?


Can you run your output through a second transformation? If so, then run the output through this XSLT (this was originally sourced from http://cocoon.apache.org/2.1/faq/faq-xslt.html) :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
   <xsl:template match="*">
     <!-- remove element prefix (if any) -->
     <xsl:element name="{local-name()}">
       <!-- process attributes -->
       <xsl:for-each select="@*">
         <!-- remove attribute prefix (if any) -->
         <xsl:attribute name="{local-name()}">
           <xsl:value-of select="."/>
         </xsl:attribute>
       </xsl:for-each>
       <xsl:apply-templates/>
     </xsl:element>
 </xsl:template>
</xsl:stylesheet>



--
Kamal Bhatt

Current Thread