o
    *ήc                     @   sX   d Z ddlmZ ddlmZ ddgiZdd Zedd	d
d Zedd	dddZdS )zModule with some functions for MathML, like transforming MathML
content in MathML presentation.

To use this module, you will need lxml.
    )get_resource)doctest_depends_on)	apply_xslc2plxmlc                 C   s   d|  d S )Nz<math xmlns:mml="http://www.w3.org/1998/Math/MathML"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3.org/1998/Math/MathML
        http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd">z</math> )sr   r   F/tmp/pip-target-vg8gfxp4/lib/python/sympy/utilities/mathml/__init__.pyadd_mathml_headers   s
   r
   )r   )modulesc                 C   sF   ddl m} |t| }||}|| }||}t|}|S )a1  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 sympy.utilities.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>'

    r   )etree)r   r   XMLr   readXSLTstr)mmlxslr   r   	transformdocresultr   r   r	   r      s   

r   Fc                 C   s*   |  ds	t| } |rt| dS t| dS )aW  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 sympy.utilities.mathml import c2p
    >>> mml = '<apply> <exp/> <cn>2</cn> </apply>'
    >>> c2p(mml,simple=True) != c2p(mml,simple=False)
    True

    z<mathzmathml/data/simple_mmlctop.xslzmathml/data/mmlctop.xsl)
startswithr
   r   )r   simpler   r   r	   r   -   s
   


r   N)F)	__doc__sympy.utilities.pkgdatar   sympy.utilities.decoratorr   __doctest_requires__r
   r   r   r   r   r   r	   <module>   s    

