← Prev in month ← Prev in thread

Using MathML XSL Stylesheets with XHTML and HtmlHelp

From
<>
Date
2008-10-31T23:08:34+00:00
ID
Thread
Using MathML XSL Stylesheets with XHTML and HtmlHelp
All,

After much testing and many conversations on this maillist, I have MathML 
working for XHTML (on IE) and HtmlHelp. I used the XSL MathML stylesheets from 
W3Cso I did not have to deal with Java or JavaScript plug-ins. This solution is 
primarily XSL based using the Docbook XSL 1.74. I used XSLTProc as a processor, 
but I also tested it with Saxon 6.5.5.

 

This solution was prompted by the fact that HtmlHelp uses IE for rendering. 
IE does not natively support MathML like Mozilla does. If you are using Mozilla, 
you do not have to use this method - Mozilla will just ignore it anyway. 
However, if you want to have a broader audience of browsers without relying on a 
particular plug-in, this solution may work for you.

 

Please let me know if you have any comments.

 

Regards,

Dean Nelson

 

--------------------------------------

Preparation

Download the XSL stylesheets for MathML (http://www.w3.org/Math/XSL/xsl.zip) 
as mentioned in the http://www.w3.org/Math/XSL/Overview-tech.html document.

 

MathML/XHTML on Internet Explorer

To get the MathML rendered with the XSL stylesheets, XHTML must be used. 
The following changes need to be made to the Docbook customization layer and 
processing.

 

1. Add the MathML stylesheet via the  "user.preroot" template:

 

<xsl:template name="user.preroot">
  
<xsl:processing-instruction 
name="xml-stylesheet">
     
<xsl:text>type="text/xsl" href="mathml.xsl"</xsl:text>
  
</xsl:processing-instruction>
</xsl:template>

This lets the browser know that you have an XSL stylesheet that 
you want to use. In this case, the mathml.xsl stylesheet from W3C. 

 

2. Make the output extension type XML

 

<xsl:param name="html.ext">.xml</xsl:param>

 

MathML will only work with an XML file in Internet Explorer.

 

3. Copy the MathML XSL stylesheets to the same directory as the output file 
(for convenience of reference). You can place it in a directory and adjust 
the path and filename in step 1, if required.

 

HtmlHelp 

 

1. Add the stylesheet via the  user.preroot parameter:

 

<xsl:template name="user.preroot">
  
<xsl:processing-instruction 
name="xml-stylesheet">
     
<xsl:text>type="text/xsl" href="mathml.xsl"</xsl:text>
  
</xsl:processing-instruction>
</xsl:template>

This lets the browser know that you have an XSL stylesheet that 
you want to use. In this case, the mathml.xsl stylesheet from 
W3C. 
 

2. Make the output extension type XML

 

<xsl:param name="html.ext">.htm.xml</xsl:param>

 

HtmlHelp needs a file extension to start with ".h".

3. Copy the MathML XSL stylesheets to the same directory as the output 
file.

 

4. Add additional chunking parameters. This is because the stock HTMLHELP 
stylesheets do not emit XML declarations.

 

<xsl:param name="chunker.output.doctype-public">-//W3C//DTD XHTML 1.0 
Transitional//EN</xsl:param>
<xsl:param 
name="chunker.output.doctype-system">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</xsl:param>
<xsl:param 
name="chunker.output.omit-xml-declaration">no</xsl:param>
<xsl:param 
name="chunker.output.method">xml</xsl:param>
<xsl:param 
name="chunker.output.indent">yes</xsl:param>
<xsl:param 
name="chunker.output.standalone">no</xsl:param>
<xsl:param 
name="chunker.output.encoding">UTF-8</xsl:param>  (or whatever 
locale setting you need)

 

 

5. Adjust/add the stylesheets to the tail of HELP.

 

 <xsl:param 
name="htmlhelp.hhp.tail"> mathml.xsl
   
ctop.xsl
   pmathml.xsl
  
 pmathmlcss.xsl
 </xsl:param>

 

This is also a good place to add any CSS stylesheets that you are 
using.

6. Process the HtmlHelp and ignore the messages that say "HHC3004: Warning: 
toc.hhc : The HTML tag "?xml version="1.0" encoding="iso-8859-1" standalon..." 
is not a valid HTML tag (it does not begin with an alphanumeric 
character)."

 

-----------------------------

Plan your next getaway with AOL Travel.  Check out Today's Hot 5 Travel Deals!
← Prev in month ← Prev in thread