XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] SGML complexity

juanrgonzaleza@canonicalscience.com wrote:
> 
> transforming this
> 
> <math code="LaTeX">x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}</math>
> 
> to this
> 
> <math>
>   <mi>x</mi>
>   <mo>=</mo>
>   <mfrac>
>     <mrow>
>       <mrow>
>         <mo>-</mo>
>         <mi>b</mi>
>       </mrow>
>       <mo>&PlusMinus;</mo>
>       <msqrt>
>         <msup>
>           <mi>b</mi>
>           <mn>2</mn>
>         </msup>
>         <mo>-</mo>
>         <mrow>
>           <mn>4</mn>
>           <mo>&InvisibleTimes;</mo>
>           <mi>a</mi>
>           <mo>&InvisibleTimes;</mo>
>           <mi>c</mi>
>         </mrow>
>       </msqrt>
>     </mrow>
>     <mrow>
>       <mn>2</mn>
>       <mo>&InvisibleTimes;</mo>
>       <mi>a</mi>
>     </mrow>
>   </mfrac>
> </math>
> 
> can be a nightmare in XSLT 1 (specially when compared with JS-DOM or PHP
> methods). I do not know of XSLT 2 new capabilities but Mike here could say
> us something.
> 

If I had such a transformation to perform, I would simply do it like this :
<xsl:template match="math[code='LaTeX'"]>
     <xsl:value-of select="lib:latex2mathml( . )"/>
<xsl:template>
or even if you don't know how to bind a function library to your XSLT 
processor :
<xsl:template match="math[code='LaTeX'"]>
     <xsl:value-of select="document( concat( 
'http://my.rest.service/latex/2/mathml?code=', . ) )"/>
<xsl:template>

Nobody said that XSLT must be standalone, and I'm sure it's easy to find 
a converter for LaTeX.
As you combined some XML tags with LaTeX, why not using both tools and 
make a smart bridge between them ?

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS