[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Evaluation of MathML using XSLT


Subject: Re: [xsl] Evaluation of MathML using XSLT
From: "Peter Rushforth" <peter.rushforth@xxxxxxxxx>
Date: Thu, 7 Feb 2008 08:03:36 -0500

Hi David,

Thanks for your response.

> yes in our case we're generating (C, C#, ...) code with xslt  so the math
> evaluation is defered to the result evaluation, not actually evaluated
> in the stylesheet.

I'm thinking of business inputs which are xml and therefore prime
fodder for XSLT
stylesheets, but for which the processing rule is encoded in an external
document, which might itself be a stylesheet snippet.  Realizing that XSLT is
perhaps not the best place to do math,but often it is expedient.

The "business rule" would be a combination of XSLT and MathML, perhaps
encoded together, such that when transformed, would be executable,
perhaps by the next (XSLT) step in the pipeline.

An input business rule might look something like:

<xsl:template match="PurchaseOrder">
  <xsl:for-each select="LineItem">
    <math xmlns="http://www.w3.org/1998/Math/MathML">
     <!-- calculate the tax per item, or something -->
      <apply>
       <times>
        <cn/>
        <cn>0.05</cn>
       </times>
      </apply>
    </math>
  </xsl:for-each>
</xsl:template>

(Sorry for the lame example! )

The output would be an actionable XSLT template, which when loaded
into a stylesheet
,compiled  and applied to input document containing PurchaseOrder elements
would do the work.

I'm certain C would be faster, but maybe the combination of XSLT and MathML
might allow a nice friendly input system.  But, perhaps it would
be just as possible to generate C code that would work similarly and perhaps
the result would be more satisfactory because of performance.

Cheers,
Peter


Current Thread
Keywords