diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/xsl/LaTeXML/LaTeXML-math-mathml.xsl')
-rw-r--r-- | Master/texmf-dist/source/latex/stex/xsl/LaTeXML/LaTeXML-math-mathml.xsl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/stex/xsl/LaTeXML/LaTeXML-math-mathml.xsl b/Master/texmf-dist/source/latex/stex/xsl/LaTeXML/LaTeXML-math-mathml.xsl new file mode 100644 index 00000000000..ca9954a3494 --- /dev/null +++ b/Master/texmf-dist/source/latex/stex/xsl/LaTeXML/LaTeXML-math-mathml.xsl @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/=====================================================================\ +| LaTeXML-math-mathml.xsl | +| copy MathML for xhtml | +|=====================================================================| +| Part of LaTeXML: | +| Public domain software, produced as part of work done by the | +| United States Government & not subject to copyright in the US. | +|=====================================================================| +| Bruce Miller <bruce.miller@nist.gov> #_# | +| http://dlmf.nist.gov/LaTeXML/ (o o) | +\=========================================================ooo==U==ooo=/ +--> +<xsl:stylesheet + version = "1.0" + xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" + xmlns:ltx = "http://dlmf.nist.gov/LaTeXML" + xmlns = "http://www.w3.org/1999/xhtml" + xmlns:m = "http://www.w3.org/1998/Math/MathML" + xmlns:xlink = "http://www.w3.org/1999/xlink" + exclude-result-prefixes = "ltx"> + + <xsl:template match="ltx:Math"> + <xsl:apply-templates select="m:math"/> + </xsl:template> + + <!-- Copy MathML, as is --> + <xsl:template match="*[namespace-uri() = 'http://www.w3.org/1998/Math/MathML']"> + <xsl:element name="{name()}" namespace='http://www.w3.org/1998/Math/MathML'> + <xsl:for-each select="@*"> + <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute> + </xsl:for-each> + <!-- firefox needs the xlink:type attribute --> + <xsl:if test="@*[namespace-uri() = 'http://www.w3.org/1999/xlink'] and not(@xlink:type)"> + <xsl:attribute name="type" namespace='http://www.w3.org/1999/xlink'>simple</xsl:attribute> + </xsl:if> + <!-- copy the ltx:Math xml:id --> + <xsl:if test="parent::ltx:Math/@xml:id"> + <xsl:attribute name="xml:id"><xsl:value-of select="parent::ltx:Math/@xml:id"/></xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> |