[docbook-css] Different image resources for HTML & FO output

David Holroyd dave at badgers-in-foil.co.uk
Tue, 19 Oct 2004 20:08:00 +0000


On Mon, Oct 18, 2004 at 09:22:25PM +0100, martin.gautier@myrnham.co.uk wrote:
> The DocBook stylesheets have hard-coded support for the "role" attribute 
> in the <imageobject> element such that authors can include multiple 
> <imageobject>s with their own roles of "html" or "fo". This allows 
> different image resolutions depending on the target. The stylesheets are 
> built to support this. Here's an example:
> 
> <inlinemediaobject>
>   <imageobject role="html"><imagedata format="PNG" 
> fileref="figure\dialog_100.png"/></imageobject>
>   <imageobject role="fo"><imagedata format="PNG" 
> fileref="figure\dialog_300.png"/></imageobject>
> </inlinemediaobject>
> 
> When viewing the XML through a browser with docbook-css you might not want 
> to see both images. My customisation layer now includes:
> 
> imageobject[role="fo"] {
>   display: none;
> }

This is a fair solution to the problem.  However, I'm not sure that the
possible values for 'role' are well-defined enough to blacklist all those
that don't apply.  Also, I think that some stylesheets are quite happy to
just inspect the files and pick the media that tastes good, so it would
be nice to try and cope with documents written assuming that behaviour.

I was thinking about changing the XBL such that, rather than simply
binding to all the <imageobject> elements, a binding is made to the
containing <mediaobject>.  That binding would then, somehow, make a
reasonable selection from the <imageobject> children.

I was thinking it might be possible to implement a suck-it-and-see
strategy, where the browser tries to load every <imageobject>, in order,
until if finds one that loads successfully.  Any solution that involves
me writing vast amounts of mozilla-specific javascript is a solution I
want to avoid, though.


dave