modelparameters.sympy.utilities.mathml package¶
Module contents¶
Module with some functions for MathML, like transforming MathML content in MathML presentation.
To use this module, you will need lxml.
- modelparameters.sympy.utilities.mathml.apply_xsl(mml, xsl)[source]¶
Apply a xsl to a MathML string @param mml: a string with MathML code @param xsl: a string representing a path to a xsl (xml stylesheet)
file. This file name is relative to the PYTHONPATH
>>> from ..mathml import apply_xsl >>> xsl = 'mathml/data/simple_mmlctop.xsl' >>> mml = '<apply> <plus/> <ci>a</ci> <ci>b</ci> </apply>' >>> res = apply_xsl(mml,xsl) >>> ''.join(res.splitlines()) '<?xml version="1.0"?><mrow xmlns="http://www.w3.org/1998/Math/MathML"> <mi>a</mi> <mo> + </mo> <mi>b</mi></mrow>'
- modelparameters.sympy.utilities.mathml.c2p(mml, simple=False)[source]¶
Transforms a document in MathML content (like the one that sympy produces) in one document in MathML presentation, more suitable for printing, and more widely accepted
>>> from ..mathml import c2p >>> mml = '<apply> <exp/> <cn>2</cn> </apply>' >>> c2p(mml,simple=True) != c2p(mml,simple=False) True