C
Chris Chiasson
Hi,
After reading and experimenting for a several hours, I have this
stylesheet:
<?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: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="{namespace-uri(.)}">
<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>
which transforms this file
<?xml version="1.0" encoding="UTF-8"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
mathematica:form="TraditionalForm"
xmlns:mathematica="http://www.wolfram.com/XML/">
<mml:mstyle mathsize="10" fontfamily="Times New Roman">
<mml:mrow>
<mml:mi>F</mml:mi>
<mml:mo>=</mml:mo>
<mml:mrow>
<mml:msup>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>1</mml:mn>
</mml:msub>
<mml:mn>2</mml:mn>
</mml:msup>
<mml:mo>-</mml:mo>
<mml:mrow>
<mml:mn>3</mml:mn>
<mml:mo></mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
<mml:mo></mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>1</mml:mn>
</mml:msub>
</mml:mrow>
<mml:mo>+</mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>1</mml:mn>
</mml:msub>
<mml:mo>+</mml:mo>
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mo></mml:mo>
<mml:msup>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
<mml:mn>2</mml:mn>
</mml:msup>
</mml:mrow>
<mml:mo>-</mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
</mml:mrow>
</mml:mrow>
</mml:mstyle>
</mml:math>
into this:
<?xml version="1.0"?>
<math xmlns="http://www.w3.org/1998/Math/MathML"
form="TraditionalForm">
<mstyle mathsize="10" fontfamily="Times New Roman">
<mrow>
<mi>F</mi>
<mo>=</mo>
<mrow>
<snip/>
</math>
as you can see, it does properly localize the MathML elements and
attributes. Unfortunately, it doesn't exclude the mathematica:form
attribute - it just localizes it. So, how can this attribute be
removed?
Thank you,
After reading and experimenting for a several hours, I have this
stylesheet:
<?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: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="{namespace-uri(.)}">
<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>
which transforms this file
<?xml version="1.0" encoding="UTF-8"?>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"
mathematica:form="TraditionalForm"
xmlns:mathematica="http://www.wolfram.com/XML/">
<mml:mstyle mathsize="10" fontfamily="Times New Roman">
<mml:mrow>
<mml:mi>F</mml:mi>
<mml:mo>=</mml:mo>
<mml:mrow>
<mml:msup>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>1</mml:mn>
</mml:msub>
<mml:mn>2</mml:mn>
</mml:msup>
<mml:mo>-</mml:mo>
<mml:mrow>
<mml:mn>3</mml:mn>
<mml:mo></mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
<mml:mo></mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>1</mml:mn>
</mml:msub>
</mml:mrow>
<mml:mo>+</mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>1</mml:mn>
</mml:msub>
<mml:mo>+</mml:mo>
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mo></mml:mo>
<mml:msup>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
<mml:mn>2</mml:mn>
</mml:msup>
</mml:mrow>
<mml:mo>-</mml:mo>
<mml:msub>
<mml:mi>X</mml:mi>
<mml:mn>2</mml:mn>
</mml:msub>
</mml:mrow>
</mml:mrow>
</mml:mstyle>
</mml:math>
into this:
<?xml version="1.0"?>
<math xmlns="http://www.w3.org/1998/Math/MathML"
form="TraditionalForm">
<mstyle mathsize="10" fontfamily="Times New Roman">
<mrow>
<mi>F</mi>
<mo>=</mo>
<mrow>
<snip/>
</math>
as you can see, it does properly localize the MathML elements and
attributes. Unfortunately, it doesn't exclude the mathematica:form
attribute - it just localizes it. So, how can this attribute be
removed?
Thank you,