Discussion:
Use the role attribute to select <mediaobject>
Steinar Bang
2003-03-17 20:44:48 UTC
Permalink
From v1.60.1, the DocBook XSL style sheets started using the role
attribute to select which <mediaobject> alternative to select for a
given result format.

This makes it possible to eg. pick a different (higher resolution, or
scaled) PNG for XSL:FO, than for HTML.

I think it would be useful if db2latex followed this practice.

See these links for more info:
http://docbook.sourceforge.net/release/xsl/current/doc/html/use.role.for.mediaobject.html
http://docbook.sourceforge.net/release/xsl/current/doc/common/common.html

Thanx!


- Steinar


-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
James Devenish
2003-03-18 09:31:24 UTC
Permalink
Hi,
Post by Steinar Bang
From v1.60.1, the DocBook XSL style sheets started using the role
attribute to select which <mediaobject> alternative to select for a
given result format.
This makes it possible to eg. pick a different (higher resolution, or
scaled) PNG for XSL:FO, than for HTML.
There has also been some off-list correspondence about this. Some
thoughts of mine:

- Mediaobjects can contain imageobjects. In the case that imageobjects
are present, DB2LaTeX is unable to choose the correct file formats
because it does not know what typesetter you are going to use.
- If we are to support $use.role.for.mediaobject and
$preferred.mediaobject.role, we would have to choose a role (such
as the existing 'html' or 'fo') that corresponds to DB2LaTeX/LaTeX.

There are at least three places where the correct image data format can
be chosen:

- at the level of mediaobjects (using $preferred.mediaobject.role).
- at the level of imagedata's @format attribute.
- at the level of "filename extensions" in imagedata's @fileref
attributed (of course, this should not really be the way it is
done, though existing DocBook stylesheets sometimes let authors
rely on this).

Personally, I think any of these requires either:

- user intervention (e.g. that the user uses a driver file to define the
allowed imagedata @formats).
- election of a mediaobject role that is devoted to LaTeX/DB2LaTeX and
to have users OMIT the filename extension (e.g. ".eps") so that LaTeX
picks up the default file type. LaTeX users will know that LaTeX and
pdfLaTeX can choose the correct image formats (e.g. choose between
"fig2.eps", "fig2.eps", "fig2.png") if the author uses
\includegraphics{fig} (i.e. leaves off the extension).

Thoughts?




-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink?
You could win a Tablet PC. Get a free Tablet PC hat just for playing.
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
Steinar Bang
2003-03-18 20:31:52 UTC
Permalink
Post by James Devenish
- If we are to support $use.role.for.mediaobject and
$preferred.mediaobject.role, we would have to choose a role (such
as the existing 'html' or 'fo') that corresponds to DB2LaTeX/LaTeX.
Why not use a new role value? "tex"? Or "latex"? Then you could add
a new <imageobject> for use by DB2LaTeX.

The new use of role was done without any changes to the DTD, so the
value of role is still defined to be #CDATA.

Here's an example of how I currently use this approach:

<mediaobject>
<imageobject role="html">
<imagedata fileref="images/press_enter.png" format="PNG"/>
</imageobject>
<imageobject role="fo">
<imagedata fileref="images/press_enter.png" format="PNG"
depth="5cm" scalefit="1"/>
</imageobject>
</mediaobject>

If I were to use this with DB2LaTeX, as well as the current HTML and
XSL:FO, I would add an extra <imageobject>, with scaling and role
"latex", ie.:

<mediaobject>
<imageobject role="html">
<imagedata fileref="images/press_enter.png" format="PNG"/>
</imageobject>
<imageobject role="fo">
<imagedata fileref="images/press_enter.png" format="PNG"
depth="5cm" scalefit="1"/>
</imageobject>
<imageobject role="latex">
<imagedata fileref="images/press_enter.png" format="PNG"
depth="5cm" scalefit="1"/>
</imageobject>
</mediaobject>



-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink?
You could win a Tablet PC. Get a free Tablet PC hat just for playing.
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
James Devenish
2003-03-19 01:26:44 UTC
Permalink
Post by Steinar Bang
Post by James Devenish
- If we are to support $use.role.for.mediaobject and
$preferred.mediaobject.role, we would have to choose a role (such
as the existing 'html' or 'fo') that corresponds to DB2LaTeX/LaTeX.
Why not use a new role value? "tex"? Or "latex"? Then you could add
a new <imageobject> for use by DB2LaTeX.
Exactly my point :)

Elsewhere in DB2LaTeX there is already use of @role="tex". What makes me
uncertain about it is that our imagedata handling won't work with plain
TeX, so "tex" is a bit of a misnomer. We could easily accept either
"tex" or "latex", but a decision would have to be made about whether
this was appopriate :)




-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink?
You could win a Tablet PC. Get a free Tablet PC hat just for playing.
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
Steinar Bang
2003-03-19 21:48:02 UTC
Permalink
Post by James Devenish
Exactly my point :)
Yah! I really shouldn't post to mailing lists when I'm too sleepy to
read and understand the message I'm responding to. :-)

But I least I posted my real life example, which is to use the role
when the <imageobject> elements are otherwise indistinguishable.
Post by James Devenish
makes me uncertain about it is that our imagedata handling won't
work with plain TeX, so "tex" is a bit of a misnomer.
I agree.
Post by James Devenish
We could easily accept either "tex" or "latex", but a decision would
have to be made about whether this was appopriate :)
How about accepting both "tex" and "latex" for the places where it's
already in use, for legacy reasons, but mark it as deprecated in the
docs, and only accept "latex" for the new places?



-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink?
You could win a Tablet PC. Get a free Tablet PC hat just for playing.
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
Steinar Bang
2003-04-26 11:19:37 UTC
Permalink
Post by James Devenish
makes me uncertain about it is that our imagedata handling won't
work with plain TeX, so "tex" is a bit of a misnomer. We could
easily accept either "tex" or "latex", but a decision would have to
be made about whether this was appopriate :)
Hey, it's in! Kewl! :-)
http://db2latex.sourceforge.net/reference/rn43re61.html
http://db2latex.sourceforge.net/reference/rn43re62.html

Is it on by default? The refpage above doesn't say.

One question: the refpages above list the role values "TeX" and
"LaTeX". Will all lowercase values "tex" and "latex" also works?

Thanx!


- Steinar



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Steinar Bang
2003-04-26 22:11:50 UTC
Permalink
Post by Steinar Bang
Is it on by default? The refpage above doesn't say.
It's on by default. (discovered through experimentation)
Post by Steinar Bang
One question: the refpages above list the role values "TeX" and
"LaTeX". Will all lowercase values "tex" and "latex" also works?
Only "tex" and "latex" work as the role values.

"TeX" and "LaTeX" as the role values, as indicated by the reference
pages
http://db2latex.sourceforge.net/reference/rn43re61.html
http://db2latex.sourceforge.net/reference/rn43re62.html
does not work.

Perhaps the reference docs should be updated here?



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
James Devenish
2003-04-27 01:32:49 UTC
Permalink
Post by Steinar Bang
Post by Steinar Bang
One question: the refpages above list the role values "TeX" and
"LaTeX". Will all lowercase values "tex" and "latex" also works?
Only "tex" and "latex" work as the role values.
[...]
Post by Steinar Bang
Perhaps the reference docs should be updated here?
Our documentation *always* need updating ;-)
Thanks for letting us know.




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Loading...