Wiris

Documentation / MathType

  • Demos
  • Visit our website
  • Downloads
  • Contact us
  • MathType

    • WirisQuizzes

      • LearningLemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • MathFlow

                • BF FAQ

                  • Miscellaneous

                    • Wiris Integrations

                      • Home
                      • MathType
                      • Technical documentation
                      • MathType for HTML editors
                      • Formats & Standards
                      • Formats & Standards

                      Encoding attributes

                      Reading time: 1min

                      MathType integration works with MathML, but under some circumstances, it modifies the XML encoding slightly.

                      MathType imports and exports MathML which, sometimes, cannot be placed directly inside HTML files. For example, the Moodle platform filters some HTML tags (APPLET, OBJECT, EMBED, etc.) and all unrecognized XML tags, and so it removes any MathML formula. This also occurs when the MathML appears inside an HTML attribute (for example, the SRC attribute of an IMG tag) and the browser, wrongly, tries to parse it.

                      In these situations, the 5 reserved characters of XML are replaced by other characters as shown in the following table:

                      Original XML character Replacing character
                      < (#3C) « (#AB)
                      > (#3E) » (#BB)
                      & (#26) § (#A7)
                      " (#22) ¨ (#A8)
                      ' (#27) ` (#60)

                      Then, recovering the MathML from the modified version is as simple as undoing the replacement. We provide below-attached the content os a .XSLT file that does this replacement.

                      <?xml version="1.0" encoding="UTF-8"?>
                      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                       <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
                       <!-- template for text -->
                       <xsl:template match="child::text()">
                       <!-- « (#AB), » (#BB), § (#A7), ¨ (#A8), ` (#B4) -->
                       <xsl:variable name="text" select="translate(.,'&#xAB;&#xBB;&#xA7;&#xA8;','&lt;&gt;&amp;&quot;')"/>
                       <!-- ` (#B4) -->
                       <xsl:value-of disable-output-escaping="yes" select='translate($text,"&#xB4;","&apos;")'/>
                       </xsl:template>
                       <!-- template for other nodes (including attributes) -->
                       <xsl:template match="@*|*">
                       <xsl:copy>
                       <xsl:apply-templates select="@*|node()"/>
                       </xsl:copy>
                       </xsl:template>
                      </xsl:stylesheet>
                      

                      Was this article helpful?

                      Give feedback about this article

                      Related Articles

                      • MathType API documentation
                      • Tips to use with MathType for Windows
                      • MathType Add-in for Microsoft 365

                      Empowering STEM education

                      MathType

                      • Office Tools
                      • LMS
                      • XML
                      • HTML

                      WirisQuizzes

                      Learning Lemur

                      Integrations

                      Solutions

                      • Education
                      • Publishing houses – platforms and interactive
                      • Publishing houses – Print and digital
                      • Technical writers

                      Pricing

                      Downloads

                      Blog

                      • Success stories

                      About us

                      • Careers
                      • Partnership

                      Contact Us

                      Contact Sales

                      European union (European Regional Development Fund) and 1EdTech (TrustEd Apps Certified)
                      • Cookie Policy
                      • Terms of Use
                      • Privacy Policy / GDPR
                      • Student Data Privacy
                      • Compliance
                      • Cookie Settings

                      © Wiris 2026

                      Expand