[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Mixing Mathml (And SVG) with DocBook



<prologue>
On occasion, I've had the opportunity to try and get MathML and
SVG to play nice with DocBook on Debian/unstable.  I don't think
PDF output is a problem, but HTML output is.  And I think a good
chunk of why this has been a problem is philosophical.  Hence this
note to the mailing list.

There are a few different ways of generating HTML output of
various DocBook sources.  If the input is essentially all text,
there isn't any problem (as I see it).  However, if the DocBook
input involves various XML technologies (such as MathML or SVG),
then there is a problem.  At least in an HTML/XML/XHTML context.
I haven't considered the general SGML context.

MathML and SVG (and others?) are in their infancy, and I don't see
any strong concensus in how they are treated.  Amaya I had thought
was a good platform to base things on, but it seems they just want
to demonstrate the odd feature here and there.   In an OpenSource
context, Mozilla seems to have good support for MathML (I haven't
looked into SVG yet).  IE has support for MathML via plugins (I
guess), but it is quite different from Mozilla.  Can we lean
towards how Mozilla views XHTML for now?

Perhaps programatically, I think (or at least would hope) that
HTML output of DocBook source would be strict HTML 4.  I do
believe the DOCTYPE specified in the output document is the
transitional version of HTML4, and not the strict DTD.  However,
if we want to incorporate MathML or SVG in DocBook, this isn't
sufficient.  If we want to incorporate XML technologies in any
DocBook source, the output must be XHTML, and not HTML 4.
</prologue>

Enough prologue.  I am working on a document in DocBook-Website,
which incorporates MathML now (and may incorporate SVG in the
future).  Having to edit the conversion products of the Makefile
from HTML 4 into XHTML every time I remake things has been
annoying.  

So, I wrote a perl script which automates the process.  Reading
the HTML Tidy documentation, I would have thought I could set up a
config file for HTML Tidy to process most of the file (basically
translating HTML 4 into XHTML, some cleanup).  From the work I
did, I am guessing the specification of a namespace for the MathML
precludes being able to use HTML Tidy to do this.  So, if what I
hti upon was to wrap the MathML stuff in [CDATA[...]] statements,
to allow it to pass through HTML Tidy unaltered.  It seems to
work.

So, my perl script does the following:
 1) Wrap MathML section in CDATA,
 2) Process file through HTML Tidy to do bulk of translation,
 3) Undo CDATA hiding of MathML, and also put in the proper
    <?xml ... ?>
    <!DOCTYPE ...?>
    declarations to allow mozilla to display the file.
And, for how I do things, it works.

So, questions are.  Is this what should be happening?  If so, is
my perl script useful to others?  (No, I am not looking to become
famous.)  If my script is useful to others, I am glad to give it.
I am not in the support business.  (Note: I am looking for work as
a materials engineer.  Very little to do with SGML on the web.)

Gord
-- 
Matter Realisations     http://www.materialisations.com/
Gordon Haverland, B.Sc. M.Eng. President
101  9504 182 St. NW    Edmonton, AB, CA  T5T 3A7
780/481-8019            ghaverla @ freenet.edmonton.ab.ca
780/993-1274 (alt.)



Reply to: