W3C home > Mailing lists > Public > www-math@w3.org > July 2003

Re: XSL matching, that changes < into &lt; in one mathml section, while leaving other mathml sections to be transferred by pmathml.xsl

From: David Carlisle <davidc@nag.co.uk>
Date: Thu, 10 Jul 2003 14:14:13 +0100
Message-Id: <200307101314.OAA17226@penguin.nag.co.uk>
To: mortena@mip.sdu.dk
CC: www-math@w3.org


A stylesheet like the following will duplicate the element, first
copying it then  quoting all te < and & and sticking it a mmldata
attribute of an applet with name ljhgljg

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:mml="http://www.w3.org/1998/Math/MathML"
  xmlns:h="http://www.w3.org/1999/xhtml"
  xmlns="http://www.w3.org/1999/xhtml"
>

<xsl:import href="pmathml.xsl"/>

<xsl:template match="h:editFormula|editFormula">
<xsl:copy-of select="*"/>
<applet name="ljhgljg">
  <xsl:attribute name="mmldata">
<xsl:apply-templates mode="verb" select="*"/>
</xsl:attribute>
</applet>

</xsl:template>
</xsl:stylesheet>




input test file and output result follow:




<html
 xmlns="http://www.w3.org/1999/xhtml"
 >
<head>
<title>Presentation Examples</title>
</head>
<body>

<h1>Presentation MathML</h1>
<p>yyy</p>

<editFormula>
 <math  xmlns="http://www.w3.org/1998/Math/MathML"
>
         <mi>a</mi>
         <mo>+</mo>
         <mi>b</mi>
</math>
</editFormula>

<p>
xxx
</p>

</body>
</html>

produces:



<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:h="http://www.w3.org/1999/xhtml">
<head>
<title>Presentation Examples</title>
</head>
<body>

<h1>Presentation MathML</h1>
<p>yyy</p>

<math xmlns="http://www.w3.org/1998/Math/MathML">
         <mi>a</mi>
         <mo>+</mo>
         <mi>b</mi>
</math><applet name="ljhgljg" mmldata="&lt;math&gt;&#xA;         &lt;mi&gt;a&lt;/mi&gt;&#xA;         &lt;mo&gt;+&lt;/mo&gt;&#xA;         &lt;mi&gt;b&lt;/mi&gt;&#xA;&lt;/math&gt;"/>

<p>
xxx
</p>

</body>
</html>

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Received on Thursday, 10 July 2003 09:14:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:55 GMT