-
Notifications
You must be signed in to change notification settings - Fork 3
/
mml2tex.xsl
executable file
·45 lines (36 loc) · 1.36 KB
/
mml2tex.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http:https://www.w3.org/1999/XSL/Transform"
xmlns:fn="http:https://www.w3.org/2005/xpath-functions"
xmlns:xs="http:https://www.w3.org/2001/XMLSchema"
xmlns:saxon="http:https://saxon.sf.net/"
xmlns:tr="http:https://transpect.io"
xmlns:mml="http:https://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="saxon tr fn mml xs">
<xsl:import href="http:https://transpect.io/mml2tex/xsl/mml2tex.xsl"/>
<xsl:output method="text" encoding="UTF-8"/>
<xsl:preserve-space elements="mml:mn mml:mi mml:mtext mml:mo mml:ms"/>
<xsl:param name="debug" select="'no'"/>
<xsl:param name="debug-dir-uri" select="'debug'"/>
<xsl:template match="mml:math">
<xsl:processing-instruction name="mml2tex">
<xsl:apply-templates select="." mode="mathml2tex"/>
</xsl:processing-instruction>
</xsl:template>
<xsl:template match="*|@*|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
<!-- debugging -->
<xsl:if test="$debug eq 'yes'">
<xsl:result-document indent="yes" method="xml" href="{$debug-dir-uri}/mml2tex/mml2tex.xml'">
<xsl:apply-templates select="*"/>
</xsl:result-document>
</xsl:if>
</xsl:template>
</xsl:stylesheet>