On 11/12/2011 03:33 PM, Paul Tremblay wrote:
A while back Dave Pawson posted a question about graph2svg:
I am wondering about the status and usefulness of the stylesheets.
First, the stylesheets require an xsl
processor, and the only xsl 2 processor is Saxon. However, if you use
the latest version of Saxon,
saxon9he.jar, the stylesheets crash because this processor does not
accept built in functions. Instead, one has to download the older
version to get the stylesheets to work.
But the documentation for the stylesheets is very sparse. The original
is in Russian, a language I don't read. I can't figure out simple
things like how to put labels on my x and y axis. Also, the SVG
document has no width and height attribute in the root element. So far
as I understand, that makes it unusable for FO implementation, or at
least FOP processing. FOP requires a height and width attribute. You
just can't put these attributes in after the document is generated
because it will throw the scale off.
I have used them (as a two part exercise) in a (quite large) docbook
document.
Put simply they work for me?
Agreed on the documentation... I got out of it what I put into it.
Here, my usage.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE msgr SYSTEM "/sgml/svg/graph2svg/msgr/msgr.dtd">
<msgr xmlns="http://graph2svg.googlecode.com"
yAxisType="shifted" xGrid="major"
yGrid="major" legend="right">
<title>Graph Title</title>
<names>
<name>09-12-01</name>
<name>10-01-05</name>
<name>10-01-12</name>
<name>10-01-16</name>
...
</names>
<values>
<title>axis label </title>
<value>120</value>
<value>124</value>
<value>126</value>
<value>127</value>
...
</values>
</msgr>
In ant I use
<echo>Generate aprilbm.svg</echo>
<call-xslt2
source="aprilbm.xml"
output="${local_graphics_src}/graphics/aprilbm.svg"
stylesheet="${use_xygr2svg_xsl}"
/>
Where the macro is
<macrodef name="call-xslt2" backtrace="true">
<attribute name="source"/>
<attribute name='stylesheet'/>
<attribute name="output"/>
<sequential>
<java classname="${xslt2_processor}"
fork="yes"
dir="${basedir}"
failonerror="true">
<classpath refid="xslt2.processor.classpath" />
<jvmarg
line="-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"/>
<jvmarg
line="-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<jvmarg
line="-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
<arg value="-l"/>
<arg value="-o"/>
<arg value="@{output}"/>
<arg line="-x org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<arg line="-y org.apache.xml.resolver.tools.ResolvingXMLReader"/>
<arg line="-r org.apache.xml.resolver.tools.CatalogResolver "/>
<arg line="${basedir}/@{source} @{stylesheet} " />
</java>
</sequential>
</macrodef>
The max x and y values are based on the data, so shouldn't be a problem,
though I can't
recall dealing with those? Let me know if it still is.
btw, I have a version of the stylesheets with English comments?
In the xslt 1.0 file I have
<figure xml:id="ch10.fig1">
<title>Plot of Oct 09</title>
<mediaobject>
<imageobject>
<imagedata fileref="graphics/octbm.svg" format="SVG"
contentwidth="180mm"/>
</imageobject>
<textobject>
<phrase>title </phrase></textobject>
<caption><para>Plot of alt text</para></caption>
</mediaobject>
</figure>
Quote, that works for me, ymmv?
HTH
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]