David J Craigon wrote:
To put it another way, I'd like server-side rendering of a XHTML+SVG document for browsers that don't support embedded SVG (that's (almost) all of them at the moment).

a) Does anyone know of anyone who as done this sort of thing with AxKit. I've found a plugin that converts solo SVG into a PNG, and a wrapper for librsvg on CPAN.
b) Do people think this is a good idea, or a stinky one?

I think it's a good idea (or at least a fun one ;) if you have a good reason for doing the entire transformation as a single step, that it, if the XHTML+SVG really constitute one document. If it's just because you can, then that's still ok but you have to understand that you're creating extra work for yourself. It's an especially good idea if you intend to publish to mobile platforms, where XHTML+SVG is all the rage (eg Vodafone switching 75% of its fleet to XHTML+SVG Tiny 1.1 in Sept, and 100% to XHTML+SVG Tiny 1.2 in March). At some point in the not too distant future the desktop browsers ought to catch up as well.


I'm not fully up to date as to the capabilities of librsvg, so be careful with what SVG you produce as it might not be able to rasterise it all. If you need advanced SVG rendering (eg filters) you can also use Batik (yes I know it's Java, but it's the best renderer out there).

> For super bonus points, it could transform <a> tags in the SVG into an
> image-map.

That's where things get tougher, a lot tougher. You could do a poor man's emulation if you make a contract with yourself to use very simple SVG (perhaps transforms, but no clipping, masking, etc) and don't do linking the way SVG does (eg in SVG, <a><text>foo</text></a> will be clickable only on the actual glyphs of foo, not on its bounding box as in XHTML).

The fact is in the general case, even for something super simple like <a><rect/></a> you can't just generate a rectangular image map because the rect might have been transformed multiple times, clipped, might have pointer-events turned off, or it might not even be displayed.

So in order to do that reasonably you'd have to use something like Batik, ask it for the bounding box of the elements in the link, and use that for your image map. It's not completely crazy, but it won't be very pleasant.

There is a proposal for XSLT extensions to support that kind of operation on SVG document (look notably at svg:bounding-box()) but I don't expect anyone to implement it before the SVG WG turns it into a working draft (provided it ever does), and the SVG WG is extremely busy dragging SVG 1.2 to Last Call these days, so it's unlikely to move forward much. Feel free to use it at your leisure and to implement bits of it if you feel like it (ping me with questions, it's not all well documented):

  http://www.expway.com/robin/SVG-XPath/svg-xpath.html

Hope you're enjoying SVG!

--
Robin Berjon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to