Re: [xsl] How can I know if a node has already been processed ?

Subject: Re: [xsl] How can I know if a node has already been processed ?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 6 Nov 2008 22:22:31 GMT
> sin x should be translated sin(x) but is translated sin(x)x

when processing MathML (which was an explict use case during the design
phase of XSLT, including joint teleconference between math and xsl
working groups to make sure that processing mathml was feasible) you
want to process the abstract function tree not the xml tree directly.
so in sin(x) you want to think of sin as a head with child x, process
sin first and then prcess the child.

However the markup is


so x is a sibling of sin not its child. However you should write your
templates with a mental model as if sin were the parent.

You don't want the template matching apply just to process all its
children, you want the processing of x to be controlled by the first
child of the apply (sin). One way s always to match on thins like
to just match an apply with head sin.

look at which is processing contnet
mathml to presentation mathml, but themethods of matching mathl
structures are usually very similar whatevr the output format.

It basically consists of a lot of templates like:
<xsl:template mode="c2p" match="mml:apply[*[1][self::mml:inverse]]">
  <xsl:apply-templates mode="c2p" select="*[2]"/>

so this is the template for inverse which typesets its "child" and
superscripts the result with -1.  the match pattern is the way it is
because the syntax is

but if the syntax had been 

The template could have been
<xsl:template mode="c2p" match="mml:mml:inverse">
  <xsl:apply-templates mode="c2p" select="*[1]"/>

which saves a few keystrokes but really isn't any simpler once you get
used to the mml:apply[*[1][self::mml:inverse]] idion used in the first


incidentally are you in touch with other people working on mathml from
braille, eg


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread