|
Subject: RE: What best graphics format for RTF and HTML, using Jade/DSSSL/DocBook From: "W. Eliot Kimber" <eliot@xxxxxxxxxx> Date: Sat, 21 Feb 1998 10:45:57 -0600 |
At 03:52 PM 2/21/98 -0000, Richard Folwell wrote:
>Do I need to put some sort of conditional statement in at this level?
(Seems
>somewhat counter to the general idea of SGML, to abstract issues like
this, but
>maybe with graphics this simply is not possible?). What I would like to
do is
>something like this:
>
><figure>
><title>A figure</title>
><graphic fileref="diagram"></graphic>
></figure>
>
>and let the formatting backend decide which format file is needed for a
>particular output type. This means that the SGML would not have to be
changed
>if support for a new backend were to be added. Of course the new graphics
>formats would need to be generated, but if all the graphics are produced by
>conversion from a single source, as you suggest, then this should not be a
>problem.
This is what external data entities are for. It requires doing three things:
1. Define an appropriate data content notation.
2. Declare entities for each graphic using a public ID
3. Create two entity mapping catalogs, one for each output process,
that map the public IDs to the appropriate version of the graphic
(this logic could also be put into the DSSSL spec, but doing it with
catalogs is probably easier)
For example, you might do something like this:
<!DOCTYPE MyDoc [
<!NOTATION
generic-graphic
PUBLIC "-//ME//NOTATION Generic Graphic that may be in any format//EN"
>
<!ENTITY
graphic-1
PUBLIC "-//ME//NONSGML Graphic One//EN"
NDATA generic-graphic
>
<!ENTITY
graphic-2
PUBLIC "-//ME//NONSGML Graphic Two//EN"
NDATA generic-graphic
>
<!ELEMENT graphic
- O
EMPTY
>
<!ATTLIST graphic
object
ENTITY
#REQUIRED
>
]>
<MyDoc>
<figure>
<title>A figure</title>
<graphic object="graphic-1">
</figure>
</MyDoc>
This gives you the notation and entity declarations. Note that I've
modified your Graphic element so that it points to the entity name using
the attribute "object", rather than pointing to a filename directly. I
also gave it a declared content of EMPTY since its effective content is the
graphic entity it points to.
For the catalogs, you would have two:
Catalog 1, say "gif-graphics.soc":
-- SGML Open Catalog for GIF versions of graphics --
PUBLIC "-//ME//NONSGML Graphic One//EN"
"graph1.gif"
PUBLIC "-//ME//NONSGML Graphic Two//EN"
"graph2.gif"
-- End of SOC catalog --
Catalog 2, say "wmf-graphics.soc":
-- SGML Open Catalog for WMF versions of graphics --
PUBLIC "-//ME//NONSGML Graphic One//EN"
"graph1.wmf"
PUBLIC "-//ME//NONSGML Graphic Two//EN"
"graph2.wmf"
-- End of SOC catalog --
Then, when you run Jade, you use the -c flag to pull in the appropriate
catalog:
jade -t sgml -dmydoc-to-html.dsl -c gif-graphics.soc mydoc.sgm > mydoc.html
jade -t rft -dmydoc-to-print.dsl -c wmf-graphics.soc mydoc.sgm
In your DSSSL specs, use the entity-generated-system-id function to get the
system ID defined by the catalog. You may then need to pull this apart to
get a usable filename or URL. Here's the function I wrote to decode
generated system IDs (which are in the formal system identifier format
defined by clause A.6 of ISO/IEC 10744:1997, see
"http://www.ornl.gov/sgml/wg4/docs/n1920/html/clause-A.6.html"):
<function>
<funcheader>
<funcname>fsi->filename</funcname>
<description>
<para>Parses a formal system ID into a filename</para>
</description>
<arguments>
<argument><arg>fsi</arg><desc>An FSI (such as returned by generated-system-id)
</desc>
</argument>
</arguments>
</funcheader>
<funcbody>
(define (fsi->filename fsi)
(let loop ((fsi fsi) (fsitag "") (sysid "") (intag #f))
(if (equal? fsi "")
sysid
(let ((c (substring fsi 0 1)))
(if intag
(if (equal? c ">")
(loop (substring fsi 1 (string-length fsi))
(string-append fsitag c) sysid #f)
(loop (substring fsi 1 (string-length fsi))
(string-append fsitag c) sysid intag))
(if (equal? c "<")
(loop (substring fsi 1 (string-length fsi))
fsitag sysid #t)
(loop (substring fsi 1 (string-length fsi))
fsitag (string-append sysid c) intag)))))))
Cheers,
E.
--
<Address HyTime=bibloc>
W. Eliot Kimber, Senior Consulting SGML Engineer
Highland Consulting, a division of ISOGEN International Corp.
2200 N. Lamar St., Suite 230, Dallas, TX 95202. 214.953.0004
www.isogen.com
</Address>
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: What best graphics format for R, Norman Walsh | Thread | Trouble building JADE, Karl Critz |
| RE: What best graphics format for R, Richard Folwell | Date | conditionaly setting characteristic, Charlie & Barbara Bo |
| Month |