This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[docbook-apps] Extracting files ?
- From: Nicolas Pillot <nicolas dot pillot at polymtl dot ca>
- To: "docbook-apps at lists dot oasis-open dot org" <docbook-apps at lists dot oasis-open dot org>
- Date: Mon, 15 Mar 2004 16:27:50 -0500
- Subject: [docbook-apps] Extracting files ?
Hello !
I am using Jeuclid to generate .GIF images from .mml files, and Batik to
generate PNG files from .svg files. Assuming i have to extract these
resources from the DocBook file, how can i safely do it ?
For example if i have this file (which does not validate due to SVG, but
i can seem to find how i can have it validate) :
<?xml version="1.0" standalone="no"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.0//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.0/dbmathml.dtd">
<book>
<chapter>
<para>
<mediaobject>
<imageobject>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="450" height="450"
viewBox="0 0 450 450">
<g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
<circle cx="6cm" cy="2cm" r="100" style="fill:red;"
transform="translate(0,50)" />
<circle cx="6cm" cy="2cm" r="100" style="fill:blue;"
transform="translate(70,150)" />
<circle cx="6cm" cy="2cm" r="100" style="fill:green;"
transform="translate(-70,150)"/>
</g>
</svg>
</imageobject>
</mediaobject>
</para>
<para>
<equation>
<title>test equation</title>
<mml:math>
<mml:mrow>
<mml:mo>∑</mml:mo>
<mml:mn>4</mml:mn>
<mml:mo>+</mml:mo>
<mml:mi>x</mml:mi>
</mml:mrow>
</mml:math>
</equation>
</para>
</chapter>
</book>
I need to create three new files:
- one valid SVG containing the content of the <svg> tag
- one valid MathML file containing the content of the <math> tag
- one stripped docbook file which would look like this
<?xml version="1.0" standalone="no"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.0//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.0/dbmathml.dtd">
<book>
<chapter>
<para>
<mediaobject>
<imageobject role="fo">
<imagedata format="SVG" fileref="generatedsvgfilename.svg"/>
</imageobject>
<imageobject role="html">
<imagedata format="PNG" fileref="generatedsvgfilename.png"/>
</imageobject>
</mediaobject>
</para>
<para>
<mediaobject>
<imageobject>
<imagedata format="PNG" fileref="generatedmmlfilename.png"/>
</imageobject>
</mediaobject>
</para>
</chapter>
</book>
Note : Jeuclid produces gif images, but i can convert them to png
using ImageMagick.
Any idea how i could do that ? I have never used an xml parser, so if
this is what i should use, i hope you can give me some hints about the
way to do it. And if there is another, more appropriate way to do the
docbook+mathml+svg conversion to html and pdf, let me know, i'd really
appreciate.
I hope this post is not too long, and someone will be able to give me
some help, because i have been trying to figure out how to do that for
the past 3 weeks, and i haven't succeeded yet :-(
Nicolas
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.