View Single Post
  #2 (permalink)  
Old May 14th, 2007, 06:50 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

Write a stylesheet containing two template rules:

 <xsl:template match="*">
  <xsl:element name="{local-name()}">
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
 </xsl:template>

 <xsl:template match="@*">
  <xsl:attribute name="{local-name()}"
    <xsl:value-of select="."/>
  </xsl:attribute>
 </xsl:template>

Note that this will remove any namespaces on attributes such as xml:space and xsi:type where the namespace may be essential to the meaning.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote