[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Re: stylesheet customization fails trying to strip a namespace prefix and some unwanted attributes
Mauritz Jeanson, Many thanks :-] I don't know why my original namespace axis specifier didn't work on the attributes. Your uh, brackets code gave me an idea, which worked. I'm sure your code works, even though I didn't test it. BTW, good call on <xsl:copy> - at the time I had xsl:attribute, I didn't realize that the namespace prefix would be automatically removed. Here is what I went with: <?xml version="1.0" encoding="UTF-8"?> <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="{namespace-uri(.)}"> <xsl:for-each select="@*[namespace-uri()=namespace-uri(parent::self)]"> <xsl:copy/> </xsl:for-each> <xsl:apply-templates/> </xsl:element> </xsl:template> </xsl:stylesheet> On 11/12/06, Mauritz Jeanson <mj@johanneberg.com> wrote: > > -----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 > > > -- http://chris.chiasson.name/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]