RE: [docbook-apps] Re: stylesheet customization fails trying to strip a namespace prefix and some unwanted attributes

From
Mauritz Jeanson <>
Date
2006-11-12T08:02:49+00:00
ID
000001c70630$f46f9a20$71ea1a51@D7MZ171J
Thread
RE: [docbook-apps] Re: stylesheet customization fails trying to strip a namespace prefix and some unwanted attributes
> -----Original Message-----
> From: Chris Chiasson
> 
> This puts the output tree in the correct namespace, but still leaves
> the form attribute...
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> 	xmlns:mml="http://www.w3.org/1998/Math/MathML"
> 	xmlns:xmlns="http://www.w3.org/2000/xmlns/"
> 	xmlns:mathematica="http://www.wolfram.com/XML/"
> 	version="1.0">
> 	<xsl:template match="mml:*">
> 		<xsl:element name="{local-name(.)}"
> namespace="http://www.w3.org/1998/Math/MathML">
> 			<xsl:for-each select="@mml:*">
> 				<xsl:attribute name="{local-name(.)}">
> 					<xsl:value-of select="."/>
> 				</xsl:attribute>
> 			</xsl:for-each>
> 			<xsl:apply-templates/>
> 		</xsl:element>
> 	</xsl:template>
> </xsl:stylesheet>


I hope that this will do the trick:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:mml="http://www.w3.org/1998/Math/MathML"
		xmlns:mathematica="http://www.wolfram.com/XML/"
		version="1.0">

  <xsl:template match="mml:*">
    <xsl:element name="{local-name(.)}"
		 namespace="http://www.w3.org/1998/Math/MathML">

      <xsl:for-each
select="@*[not(namespace-uri()='http://www.wolfram.com/XML/')]">
	 <xsl:copy/>
      </xsl:for-each>

      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>
 
</xsl:stylesheet>


/MJ