ó
¡¼™\c           @   s‚   d  Z  d d l m Z d d l m Z d d l Z i d g d 6Z d „  Z e d	 d ƒ d
 „  ƒ Z	 e d	 d ƒ e
 d „ ƒ Z d S(   s‰   Module with some functions for MathML, like transforming MathML
content in MathML presentation.

To use this module, you will need lxml.
iÿÿÿÿ(   t   get_resource(   t   doctest_depends_onNt   lxmlt	   apply_xslt   c2pc         C   s   d |  d S(   Nsì   <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">s   </math>(    (   t   s(    (    s>   lib/python2.7/site-packages/sympy/utilities/mathml/__init__.pyt   add_mathml_headers   s    t   modulesc         C   se   d d l  m } | j t | ƒ j ƒ  ƒ } | j | ƒ } | j |  ƒ } | | ƒ } t | ƒ } | S(   s1  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>'

    iÿÿÿÿ(   t   etree(   R   R   t   XMLR    t   readt   XSLTt   str(   t   mmlt   xslR   R   t	   transformt   doct   result(    (    s>   lib/python2.7/site-packages/sympy/utilities/mathml/__init__.pyR      s    c         C   s>   |  j  d ƒ s t |  ƒ }  n  | r1 t |  d ƒ St |  d ƒ S(   sW  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

    s   <maths   mathml/data/simple_mmlctop.xsls   mathml/data/mmlctop.xsl(   t
   startswithR   R   (   R   t   simple(    (    s>   lib/python2.7/site-packages/sympy/utilities/mathml/__init__.pyR   .   s
    (   R   R   (   R   (   R   (   t   __doc__t   sympy.utilities.pkgdataR    t   sympy.utilities.decoratorR   t   xml.dom.minidomt   xmlt   __doctest_requires__R   R   t   FalseR   (    (    (    s>   lib/python2.7/site-packages/sympy/utilities/mathml/__init__.pyt   <module>   s   	