[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How can I know if a node has already been processe

Subject: Re: 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
Re:  How can I know if a node has already been processe
> 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

<apply>
  <sin/>
  <mi>x</mi>
</apply>

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
apply[*[1][self::sin]
to just match an apply with head sin.

look at http://www.w3.org/Math/XSL/ctop.xsl 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]]">
 <mml:msup>
  <xsl:apply-templates mode="c2p" select="*[2]"/>
  <mml:mrow><mml:mo>(</mml:mo><mml:mn>-1</mml:mn><mml:mo>)</mml:mo></mml:mrow>
 </mml:msup>
</xsl:template>

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
<apply>
 <inverse/>
 <ci>x</ci>
</inverse>

but if the syntax had been 
<inverse>
<ci>x</ci>
</inverse>

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


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
match. 


David

incidentally are you in touch with other people working on mathml from
braille, eg
http://www.ascience.eu/?q=en/wsParis/Archambault

D

________________________________________________________________________
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.