This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: objections to mediaobject with many imagedata


On Sat, Jan 18, 2003 at 12:23:46PM -0600, Adam DiCarlo wrote:
> Jeff Beal <jeff.beal@ansys.com> writes:
> 
> > As for the general concept of having the stylesheets add an extension based
> > on the format, it seems that specifying multiple alternate mediaobjects and
> > selecting the right one for the output is a better approach.
> > 
> > <mediaobject>
> >   <imageobject>
> >     <imagedata fileref="myImageFile.eps" format="EPS"/>
> >   </imageobject>
> >   <imageobject>
> >     <imagedata fileref="myImageFile.pdf" format="PDF"/>
> >   </imageobject>
> ...
> 
> I don't know that I really agree this is optimal.  What I would like
> (and what I use) is something more like:
> 
>  <mediaobject>
>    <imageobject>
>      <imagedata fileref="myImageFile.&img.fmt.suffix;" format="&img.fmt.name;"/>
>    </imageobject>
>  </mediaobject>
> 
> This way, it's the job of the build system to define the
> img.fmt.suffix and the img.fmt.name and also convert the images as
> needed (I use makefile dependencies for this).  This takes work off of
> the author, where it shouldn't be, and onto the build system itself
> (where it should be).  This also eliminates all the redundant tagging
> and therefore makes the document itself more maintainable.

That's a great method of selecting a graphic format if your
build system is set up for it.  I'm not sure why you are
objecting, though, as you can do this now, without any
change to the stylesheets, right?

FYI, starting with the 1.59 XSL stylesheets, there is
another way of selecting a graphic format at runtime.
If the 'use.role.for.mediaobject' is nonzero, then
a role="html" in an imageobject will select that
imageobject (and its imagedata child)  when
processed by the html stylesheet.  Likewise for a value of
"fo".  So you can set up a mediaobject like this:

<mediaobject>
  <imageobject role="html">
    <imagedata fileref="myImageFile.png" format="PNG"/>
  </imageobject>
  <imageobject role="fo">
    <imagedata fileref="myImageFile.pdf" format="PDF"/>
  </imageobject>
</mediaobject>

When you process this with the html stylesheet, you get the
PNG graphic, and when you process with the fo stylesheet,
you get the PDF graphic.  For the xhtml stylesheet, you
can add an object with role="xhtml" if you want a different
one, otherwise the stylesheet falls back to selecting
role="html".

If you want finer control, such as the situation you
describe here with PDF for PDF output
and EPS for Postscript output, then you can use any
role values you want.  Then you pass the selected
role value in a command line parameter
'preferred.mediaobject.role'.

<mediaobject>
  <imageobject role="html">
    <imagedata fileref="myImageFile.png" format="PNG"/>
  </imageobject>
  <imageobject role="eps">
    <imagedata fileref="myImageFile.eps" format="EPS"/>
  </imageobject>
  <imageobject role="fo">
    <imagedata fileref="myImageFile.pdf" format="PDF"/>
  </imageobject>
</mediaobject>

To select the EPS format, set the stylesheet parameter
preferred.mediaobject.role="eps" on the command line.

This method is admitedly more verbose than yours, but is
more flexible per object.  It gives the author the
opportunity to add graphics attributes for individual
output formats to optimize each one, for example.  It also
fulfills the original design goal of the mediaobject
wrapper: to allow the author to specify several potential
objects, where one of which is selected at processing time.

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]