diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-03 22:27:51 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:19:31 +0200 |
commit | 873325de938562033aef367b18985b4bc0d61d17 (patch) | |
tree | 3fc6098c1831711d0e988e0063e871e73ccb2c29 /contrib/xslt/mathml.xsl | |
parent | ceff0d93892a6af3c3536ee645c83440c2f06b44 (diff) |
Add (not at all finished) XSLT transformations to the contrib folder
Diffstat (limited to 'contrib/xslt/mathml.xsl')
-rw-r--r-- | contrib/xslt/mathml.xsl | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/contrib/xslt/mathml.xsl b/contrib/xslt/mathml.xsl new file mode 100644 index 0000000..dc386d3 --- /dev/null +++ b/contrib/xslt/mathml.xsl @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:math="math"> + + <xsl:template match="/"> + <xsl:apply-templates select="/document/math:math"/> + </xsl:template> + + <xsl:template match="/document/math:math"> + <xsl:element name="math" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:apply-templates select="math:*"/> + </xsl:element> + </xsl:template> + + <xsl:template match="math:equation"> + <!--<xsl:element name="mtr" namespace="http://www.w3.org/1998/Math/MathML">--> + <xsl:apply-templates select="math:field"/> + <!--</xsl:element>--> + </xsl:template> + + <xsl:template match="math:field"> + <xsl:element name="mrow" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:apply-templates select="math:*"/> + </xsl:element> + </xsl:template> + + <xsl:template match="math:power"> + <xsl:element name="msup" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:apply-templates select="math:*"/> + </xsl:element> + </xsl:template> + + <xsl:template match="math:index"> + <xsl:element name="msub" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:apply-templates select="math:*"/> + </xsl:element> + </xsl:template> + + <!-- Operators --> + + <xsl:template match="math:equals"> + <xsl:element name="mo" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:text>=</xsl:text> + </xsl:element> + </xsl:template> + + <xsl:template match="math:plus"> + <xsl:element name="mo" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:text>+</xsl:text> + </xsl:element> + </xsl:template> + + <xsl:template match="math:minus"> + <xsl:element name="mo" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:text>-</xsl:text> + </xsl:element> + </xsl:template> + + <xsl:template match="math:ast"> + <xsl:element name="mo" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:text>*</xsl:text> + </xsl:element> + </xsl:template> + + <!-- Leaf elements --> + + <xsl:template match="math:number"> + <xsl:element name="mn" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:value-of select="."/> + </xsl:element> + </xsl:template> + + <xsl:template match="math:text"> + <xsl:element name="mtext" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:value-of select="."/> + </xsl:element> + </xsl:template> + + <xsl:template match="math:var"> + <xsl:element name="mi" namespace="http://www.w3.org/1998/Math/MathML"> + <xsl:value-of select="."/> + </xsl:element> + </xsl:template> + + <xsl:template math="* msup"> + + </xsl:template> + +</xsl:stylesheet> + |