W3C home > Mailing lists > Public > www-math@w3.org > July 2003

Re: correct/simplify Content MathML

From: Max Froumentin <mf@w3.org>
Date: Tue, 08 Jul 2003 16:04:13 +0200
To: "Ana Skupch" <anaskupch@cecilija.zesoi.fer.hr>
Cc: <www-math@w3.org>
Message-ID: <87vfudnmhu.fsf@w3.org>

Hi Ana,

"Ana Skupch" <anaskupch@cecilija.zesoi.fer.hr> wrote:

> I thought of writing an XSL for myself, but I would need to convert
> prefix (from MathML) to infix notation and this seems pretty
> difficult to me.

Because XSLT is recursive it's actually not so difficult

<xsl:template match="apply">
  <xsl:apply-templates select="*[2]"/>
  <xsl:apply-templates select="*[1]"/>
  <xsl:apply-templates select="*[3]"/>

<xsl:template match="plus">+</xsl:template>
<xsl:template match="ci"><xsl:apply-templates/></xsl:template>

Would work with your example.

The real difficulty lies with characters, espeially if you want to
convert &#x345F; to \lambda, if you output TeX.

You could also do the simplification in XSLT itself. I remember writing
templates to transform x+0 to x, or similar trivial ones. Of course this
will get you nowhere near the power of Mathematica or Maple, but it was
fun to write.


Received on Tuesday, 8 July 2003 10:05:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:27:34 UTC