Works like a charm! Martin Goik
On 21.10.2015 11:56, Hussein Shafie wrote: > * You are right. I was not aware (or I didn't remember) that JEuclid > allowed to convert MathML to SVG. > > * You have indeed found a nasty bug, not in JEuclid's code, not in XXE's > code but related to the integration of JEuclid in XXE: > > JEuclid uses an identity transform to save the SVG file. When Saxon > 6.5.5 is in the CLASSPATH, this identity transform is implemented by > Saxon 6.5.5 and not by the XSLT processor included in the Java runtime. > The identity transform implemented by Saxon 6.5.5 does not seem to be > namespace aware (hard to understand why). Hence the namespace > declaration missing in the SVG files generated by JEuclid. > > * I had to patch JEuclid to workaround this problem. You can download > patched jeuclid-core.jar from this private download area: > > --- > http://www.pixware.fr/_download/martin/jeuclid-core.jar > > (506418bytes, Wed Oct 21 11:43:17 CEST 2015) > --- > > This patched jeuclid-core.jar will be part of forthcoming XXE v6.5. File > jeuclid-core.jar is found in <Jeuclid_addon_install_dir>/ which is > generally <XXE_install_dir>/addon/jeuclid_imagetoolkit/. > > > > > On 10/20/2015 08:41 PM, Martin Goik wrote: >> I'm sorry to say this but your description is incorrect: Prior to Xep >> processing the Mathml files get converted to (nearly correct) svg files. >> >> You personally provided the required configuration changes on a stock >> Xmlmind installation to achieve this result roughly 6 years ago at >> http://www.mail-archive.com/xmleditor-support%40xmlmind.com/msg04583.html >> (link being mentioned in my previous mail). Based on that description >> I modified current 6.4 >> xmlmind/addon/config/docbook5/docbook5_convert_input.incl to contain: >> >> <command name="{db5}toPS.step0"> >> ... >> <cfg:extract xmlns="" >> xmlns:db5="http://docbook.org/ns/docbook" >> xmlns:mml="http://www.w3.org/1998/Math/MathML" >> xpath="//db5:imagedata/mml:math" toDir="raw"> >> <cfg:attribute name="fileref" >> value="resources/{$url.rootName}.svg" /> >> </cfg:extract> >> >> >> <resources include="image" >> match="(?:.+/)?(.+)\.(png|jpg|jpeg|gif|svg|svgz%1)" >> copyTo="resources" referenceAs="resources/$1.$2" /> <!--no "mml" --> >> >> <resources match="(?:.+/)?(.+)\.mml" >> copyTo="raw" referenceAs="%w/resources/$1.svg" /> >> ... >> </copyDocument> >> >> <convertImage from="raw/*.mml" to="resources" format="svg" /> >> <convertImage from="raw" skip="mml" >> to="resources" format="%0 png" /> >> </process> >> >> Then invoking: >> >> /usr/share/xmlmind/bin/xxetool convert -d -vvv db5.toPSFile fig.xml >> -s pdf -s "|pdf" -u ~/fig.pdf >> >> yields: >> >> xxetool: Processing XML file "/tmp/xxe1178347785568904861_d/__doc.xml" >> Making portrait pages on A4 paper (210mmx297mm) >> xxetool: Converting XSL-FO file "__doc.fo" to "__doc.pdf" using XEP >> xxetool: XEP: building the internal representation of the XSL-FO >> document... >> xxetool: error: XEP error: Failed to create image >> file:/tmp/xxe1178347785568904861_d/resources/fig_tmp_0.svg of type >> null (com.renderx.graphics.ImageFormatException: >> org.xml.sax.SAXException: Root element in an SVG image >> file:/tmp/xxe1178347785568904861_d/resources/fig_tmp_0.svg is not in >> the SVG namespace (http://www.w3.org/2000/svg)) >> xxetool: XEP: formatting the XSL-FO document... >> >> Due to the "-d" option I uploaded all (but pdf) intermediate files to >> https://cloud.mi.hdm-stuttgart.de/owncloud/index.php/s/7gXf1PjrgXLCKfJ. As >> >> you can see __doc.fo contains: >> >> <fo:external-graphic >> src="url(resources/fig_tmp_0.svg)" width="auto" height="auto" >> content-width="auto" content-height="auto"/> >> >> and resources/fig_tmp_0.svg is indeed a (nearly correct ) SVG file >> lacking a namespace declaration. As stated previously adding this >> namespace manually fixes the problem. >> >> I did not configure any Mathml to SVG converter myself. The JEuclid >> image tool plugin is present. I just don't know by which 'magic' >> MathML files get converted to SVG and how to influence this process >> accordingly. >> >> Regards, Martin Goik >> >> On 20.10.2015 16:27, Hussein Shafie wrote: >>> I'm sorry but there is a misunderstanding here. XMLmind XML Editor >>> does not provide any way to convert MathML to SVG in order >>> workaround a limitation of RenderX XEP. >>> >>> Unlike Apache FOP, XMLmind XSL-FO Converter and Antenna House XSL >>> Formatter, RenderX XEP does not support MathML at all. >>> >>> Moreover the error message reported by RenderX XEP is completely >>> incorrect. For example, Render XEP says: >>> >>> --- XEP error: Failed to create image >>> file:/tmp/xxe6447450936759804317_d/resources/imagedata_tmp_2.mml of >>> type null (com.renderx.graphics.ImageFormatException: >>> org.xml.sax.SAXException: Root element in an SVG image >>> file:/tmp/xxe6447450936759804317_d/resources/imagedata_tmp_2.mml is >>> not in the SVG namespace (http://www.w3.org/2000/svg)) --- >>> >>> RenderX XEP thinks that imagedata_tmp_2.mml is an SVG file despite >>> that fact this file starts with: >>> >>> --- <?xml version="1.0" encoding="UTF-8"?> <math display="block" >>> xmlns="http://www.w3.org/1998/Math/MathML" >>> xmlns:xlink="http://www.w3.org/1999/xlink" >>> xmlns:xi="http://www.w3.org/2001/XInclude" >>> xmlns:svg="http://www.w3.org/2000/svg" >>> xmlns:m="http://www.w3.org/1998/Math/MathML" >>> xmlns:html="http://www.w3.org/1999/xhtml" >>> xmlns:db="http://docbook.org/ns/docbook" >>>> >>> ... --- >>> >>> File imagedata_tmp_2.mml which has been automatically extracted >>> from some MathML embedded in a DocBook 5 document: >>> >>> --- <mediaobject> <imageobject> <imagedata> <m:math >>> display="block"> <m:mi>x</m:mi> >>> >>> <m:mo>=</m:mo> >>> >>> <m:mfrac> <m:mrow> <m:mrow> <m:mo>-</m:mo> >>> >>> <m:mi>b</m:mi> </m:mrow> >>> >>> <m:mo>±</m:mo> >>> >>> <m:msqrt> <m:msup> <m:mi>b</m:mi> >>> >>> <m:mn>2</m:mn> </m:msup> >>> >>> <m:mo>-</m:mo> >>> >>> <m:mrow> <m:mn>4</m:mn> >>> >>> <m:mo>⁢</m:mo> >>> >>> <m:mi>a</m:mi> >>> >>> <m:mo>⁢</m:mo> >>> >>> <m:mi>c</m:mi> </m:mrow> </m:msqrt> </m:mrow> >>> >>> <m:mrow> <m:mn>2</m:mn> >>> >>> <m:mo>⁢</m:mo> >>> >>> <m:mi>a</m:mi> </m:mrow> </m:mfrac> </m:math> </imagedata> >>> </imageobject> </mediaobject> --- >>> >>> is in fact a valid MathML file. >>> >>> >>> >>> >>> >>> On 10/19/2015 10:26 PM, Martin Goik wrote: >>>> Dear all, >>>> >>>> referring to an older answer the setup being given at >>>> http://www.mail-archive.com/xmleditor-support%40xmlmind.com/msg04583.html >>>> >>>> >>>> >> describes MathML Docbook5 PDF support by converting mml to svg and >>>> subsequently using RenderX's xep svg capabilities. >>>> >>>> This setup works for xmlmind 6.4 apart from a very small >>>> failure. >>>> >>>> Extracting docbook equations yields correct mathml exports being >>>> transformed into individual svg images. However the <svg> root >>>> elements do not carry any namespace attribute: >>>> >>>> <svg fill-opacity="1" ... , but no >>>> xmlns="http://www.w3.org/2000/svg" whatsoever, resulting in an >>>> xep Exception: >>>> >>>> xxetool: error: XEP error: Failed to create image >>>> file:/tmp/xxe1997919912855643128_d/resources/fig_tmp_0.svg of >>>> type null (com.renderx.graphics.ImageFormatException: >>>> org.xml.sax.SAXException: Root element in an SVG image >>>> file:/tmp/xxe1997919912855643128_d/resources/fig_tmp_0.svg is not >>>> in the SVG namespace (http://www.w3.org/2000/svg)) >>>> >>>> After executing xxetool with "-d" option I added the missing >>>> xmlns attribute by editing fig_tmp_0.svg manually. A subsequent >>>> execution of xep on __doc.fo gives the desired PDF result. I've >>>> however no clue at all how to convince the mml --> svg conversion >>>> process to provide the required namespace on its own. All >>>> parameters I've found so far below >>>> http://www.xmlmind.com/xmleditor/addons_doc.html#jeuclid_imagetoolkit >>>> >>>> >> are totally unrelated to namespace considerations. >>>> > > > -- > XMLmind XML Editor Support List > xmleditor-support@xmlmind.com > http://www.xmlmind.com/mailman/listinfo/xmleditor-support -- Martin Goik Tel. +49-711-8923-2164 http://www.HdM-Stuttgart.de/~goik GnuPG public key: https://www.hdm-stuttgart.de/~goik/goik.asc Früher standen sich die Menschen näher. Die Kugeln trugen nicht so weit. -- XMLmind XML Editor Support List xmleditor-support@xmlmind.com http://www.xmlmind.com/mailman/listinfo/xmleditor-support