<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Image Library Files</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD ><BODY CLASS="ARTICLE" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="ARTICLE" ><DIV CLASS="TITLEPAGE" ><H1 CLASS="TITLE" ><A NAME="AEN2" >Image Library Files</A ></H1 ><H3 CLASS="AUTHOR" ><A NAME="AEN4" >Norman Walsh</A ></H3 ><P CLASS="PUBDATE" >17 Nov 1998<BR></P ><DIV ><DIV CLASS="ABSTRACT" ><P ></P ><A NAME="AEN8" ></A ><P >Additional information about graphics files can be used to improve the presentation of images. In particular, passing the height and width of a graphic to a web browser improves layout and alternative text should always be used. Image library files provide a mechanism for passing this information to the DocBook DSSSL Stylesheets.</P ><P ></P ></DIV ></DIV ><HR></DIV ><P >Image library files can be used to pass additional information about images to the stylesheet. The HTML stylesheet uses this information in the <CODE CLASS="SGMLTAG" >IMG</CODE > tag; the print stylesheet may someday be able to use this information to get proper spacing around images, but I don't quite have that worked out yet.</P ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN12" >Image Library File Format</A ></H1 ><P >Image library files are <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >XML</I ></SPAN > documents conforming the image library DTD shown in <A HREF="imagelib.html#FIG.ILIBDTD" >Figure 1</A >.</P ><DIV CLASS="FIGURE" ><A NAME="FIG.ILIBDTD" ></A ><P ><B >Figure 1. The Image Library DTD</B ></P ><PRE CLASS="PROGRAMLISTING" ><!-- $Id: imagelib.dtd,v 1.1 2001/04/02 21:40:27 nwalsh Exp $ DTD for the image-library files used by the Modular DocBook Stylesheets. Common declaration: <?xml version='1.0'?> <!DOCTYPE image-library PUBLIC "-//Norman Walsh//DTD Image Library 1.0//EN" ""> Instances of this DTD are usually XML. --> <!-- An image-library is a collection of images --> <!ELEMENT image-library (image+)> <!-- Each image has some number of properties and may have a short --> <!-- text description and a long test description --> <!ELEMENT image (properties?, alttext?, altdesc?)> <!-- The stylesheets resolve the requested graphic to a filename --> <!-- and search for an image with that filename in the image --> <!-- library. Images may refer to each other with 'id' and --> <!-- 'sameas' attributes. --> <!ATTLIST image filename CDATA #REQUIRED id ID #IMPLIED sameas IDREFS #IMPLIED > <!-- A few image properties are universal, the rest are stored --> <!-- in HTML-style 'meta' elements. --> <!ELEMENT properties (meta*)> <!ATTLIST properties format (gif|jpeg|png|other) #IMPLIED otherformat CDATA #IMPLIED width CDATA #IMPLIED height CDATA #IMPLIED > <!-- Any additional properties that specify 'imgattr="yes"', --> <!-- will automatically be copied to the attribute list of --> <!-- the HTML IMG tag. --> <!ELEMENT meta EMPTY> <!ATTLIST meta name CDATA #REQUIRED content CDATA #REQUIRED imgattr (yes|no) "no" > <!-- The content of this element will be used as the HTML --> <!-- 'ALT' text, unless the alt text can be found in the --> <!-- instance. --> <!ELEMENT alttext (#PCDATA)> <!-- The 'altdesc' is a longer description of the image. --> <!-- It is not used at this time. --> <!ELEMENT altdesc (para+)> <!ELEMENT para (#PCDATA)> <!--EOF--></PRE ></DIV ><P >The stylesheets use the filename of the graphic file (either the name entered in the <CODE CLASS="SGMLTAG" >fileref</CODE > attribute or the system identifier of the entity in the <CODE CLASS="SGMLTAG" >entityref</CODE > attribute) to locate the appropriate image in the library.</P ></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN24" >Creating Image Library Files</A ></H1 ><P >At present, the files have to be created by hand. It's easy to imagine a tool that could scan the graphics and build the file (or at least part of the file) automatically, but none have been written yet.</P ></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN27" >Image Library File Location</A ></H1 ><P >The default location for image library files is <TT CLASS="FILENAME" >imagelib/imagelib.xml</TT >. Using a subdirectory allows the image library file to be in XML while the documents may be in SGML. If you're formatting XML documents, you can move the image library into the same directory as your documents.</P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN31" >The Catalog Trick</A ></H2 ><P >If you're formatting SGML documents, you have to employ a catalog trick in order to get Jade to properly parse the image library file. Add a catalog to the <TT CLASS="FILENAME" >imagelib</TT > directory that contains the single line: <PRE CLASS="SCREEN" >SGMLDECL "<TT CLASS="REPLACEABLE" ><I >path/to/xml.dcl</I ></TT >"</PRE ></P ><P >Jade will use that declaration to process all the documents in the <TT CLASS="FILENAME" >imagelib</TT > directory.</P ></DIV ></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN39" >Using the Image Library</A ></H1 ><P >You can use the image library in one of two ways: <P ></P ><OL TYPE="1" ><LI ><P >Turn on <TT CLASS="LITERAL" >image-library</TT > in your stylesheet: <PRE CLASS="SCREEN" >(define image-library #t)</PRE ></P ></LI ><LI ><P >Use the <CODE CLASS="OPTION" >-V image-library</CODE > option when you run jade.</P ></LI ></OL ></P ></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN50" >An Example</A ></H1 ><P >See the examples in the <TT CLASS="FILENAME" >test</TT > directory.</P ></DIV ></DIV ></BODY ></HTML >