[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: stylesheet customization fails trying to strip a namespace prefix and some unwanted attributes
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>
On 11/11/06, Chris Chiasson <chris@chiasson.name> wrote:
> Hi,
> I am trying to strip the mml: prefix from MathML elements. In
> addition, I need the xmlns:mml="some url" attribute to come through as
> xmlns="some url" and I need to eliminate the following attributes from
> the mml:math element: xmlns:mathematica and mathematica:form
>
> this is what i have so far:
>
> <xsl:template match="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
> <xsl:element name="{local-name(.)}">
> <xsl:for-each select="@mml:*">
> <xsl:attribute name="{local-name(.)}">
> <xsl:value-of select="."/>
> </xsl:attribute>
> </xsl:for-each>
> <xsl:for-each select="@xmlns:mml"
> xmlns:xmlns="http://www.w3.org/2000/xmlns/">
> <xsl:attribute name="xmlns">
> <xsl:value-of select="."/>
> </xsl:attribute>
> </xsl:for-each>
> <xsl:apply-templates/>
> </xsl:element>
> </xsl:template>
>
> it writes out the math element and its children unprefixed, but it
> also puts xmlns="" and form="TraditionalForm" in attributes of the
> math element
>
> (the original value of mathematica:form is TraditionalForm)
>
> How does one force the output to retain the MathML namespace and drop
> that form element?
>
> Thanks,
>
> --
> http://chris.chiasson.name/
>
--
http://chris.chiasson.name/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]