Hello,
"Unfortunately, there is no single graphics file format that meets all
needs." - Bob
Bob is right. One of the biggest annoyances I have when writing documents
is that, when I want to insert a graphic, I must reference and maintain
multiple versions of the image file in order to accommodate the various
types of output I am producing:
<mediaobject>
<imageobject role="fo">
<imagedata format="SVG" fileref="figure.svg"/>
</imageobject>
<imageobject role="html">
<imagedata format="PNG" fileref="figure.png"/>
</imageobject>
</mediaobject>
Let's say I created a figure in SVG, as in the above example. This SVG is
my original image source, and in a perfect world, it would be all I'd need
to carry around. But, since we can't trust SVGs with our web browsers, I
must convert it to PNG and carry around another version of the file for HTML
output.
What if I actually could only keep the SVG, and have the stylesheet somehow
convert the image to alternate formats as needed? If I run the HTML
stylesheet, it sees an SVG, and calls an external program--say,
ImageMagick--to convert the file to a PNG.
This leads me to my question. I know that with processors like Saxon and
Xalan, you can write extensions in Java/JavaScript. It seems to me that one
would be able to write an extension to call ImageMagick as needed. However,
I have absolutely no experience with XSLT extensions, and don't really know
where to start.
I do know where to find resources on the subject. However, I thought I
would first post here to see if anyone has done anything similar, or thought
about anything like this before.
- Colin