Re: [xsl] How can I compare XSLT with Programming languages for parsing XML?

Subject: Re: [xsl] How can I compare XSLT with Programming languages for parsing XML?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 24 Jul 2006 15:27:36 +0100
> Hi,
>  
> I am developing XSLT stylesheets to parse
> MathML(Mathematical markup language) and convert it to
> text. I would like to justify my design decision of
> selecting XSLT and not another programming language,
> what benefits XSLT has over others for parsing XML
> documents? 
>  
> Dima
> 

XSLT (which as others have said, isn't a parser) is ideally suited for
this. It is of course a good general purpose XML transformation language
but as it happens transforming MathML was one of the explicit use cases
looked at when designing XSLT. MathML 1 and XSLT 1 were designed
around the same time frame and we had at least one joint phone conference
between the XSL and Math Working groups where requirements for processing
XML documents like MathML were discussed. (One notable feature MathML
shares with some other vocabularies is that processing is often
controlled by the first child rather than the parent, it's 
<apply><sin/><mi>&pi;</mi></apply>
rather than
<sin><mi>&pi;</mi></sin>
some other transformation/querying languages (including early drafts of
xpath which didn't have the sibling axes in quite the same form) make
the first form rather harder to deal with than the second.

Incidentally a common reason for transforming MathML to text is as a
first stage in an audio rendering of mathematical expressions, to
generate input for a standard speech system. If that's your motivation
you may want to look at some similar projects in that area, many of
which do use XSLT.
http://www.w3.org/Math/Software/mathml_software_cat_converters.html

David

Current Thread