1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
<chapter id="customize">
<?html-filename custom.html>
<docinfo>
<pubdate role=rcs>$Date: 1999/03/18 00:38:46 $</pubdate>
</docinfo>
<title>Customizing the Stylesheets</title>
<sect1>
<title>Deriving Your Own Stylesheet</title>
<para>The best way to customize the stylesheets is to write your own “driver”
file; this is a document which contains your local modifications to the stylesheet
and then includes the stylesheet from the standard distribution by reference.
This allows you to make local changes and extensions without modifying the
distributed files, which makes upgrading to the next release much, much simpler.
</para>
<para>The basic driver file looks like this:<screen><!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY dbstyle SYSTEM "docbook.dsl" CDATA DSSSL>
]>
<style-sheet>
<style-specification use="docbook">
<style-specification-body>
;; your stuff goes here...
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="dbstyle">
</style-sheet>
</screen></para>
<para>Make sure that you specify, in the system identifier, the full path
to the <filename>docbook.dsl</filename> file that you want to customize; for
example, <filename>\docbook\print\docbook.dsl</filename>.</para>
<note><para>The next stylesheet release will probably use public identifiers
to locate the stylesheets, which will simplify this problem a bit (at the
cost, naturally, of a little more complexity elsewhere; sigh).</para>
</note>
<para>You can add your own definitions, or redefinitions, of stylesheet rules
and parameters where<screen>;; your stuff goes here...</screen> occurs in
the example above.</para>
<para>The <filename>plain.dsl</filename> stylesheet in the <filename>docbook/print
</filename> directory is a customization of the <filename>docbook.dsl</filename>
print stylesheet. It turns off title page and TOC generation.</para>
</sect1>
<sect1>
<title>Changing the Localization</title>
<para>As distributed, the stylesheets use English for all generated text,
but German and Russian localization files are also provided<footnote><para>
The non-English localization layers are sometimes a little out-of-date with
respect to generated text. If Jade reports errors that <literal>%gentext-<replaceable>
something</replaceable></literal> is undefined, that's the problem. Hopefully
the required text is fairly obvious, but if not, drop me a note and I'll explain
it. In any case, if you add appropriate text, please send it to me so I can
update the distributed localizations.</para>
</footnote> (if you can write a localization for another language, <emphasis>
please do</emphasis>, and send it to me).</para>
<para>Switching localizations is achieved by writing a customization layer
that references the proper localization file. The customization should look
like this:</para>
<screen><!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL>
<!-- The path to the l10n file must be correct, of course, and should -->
<!-- point to the print/html directory as appropriate for the preceding -->
<!-- dbstyle -->
<!ENTITY l10n SYSTEM "docbook/print/dbl1dege.dsl" CDATA DSSSL>
]>
<style-sheet>
<style-specification use="l10n docbook">
<style-specification-body>
;; Additional customization here, if desired
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="dbstyle">
<external-specification id="l10n" document="l10n">
</style-sheet>
</screen>
<para>Where <filename>dbl1dege.dsl</filename> is the name of the localization
file you wish to use (German in this example)..</para>
</sect1>
<sect1>
<title>A Single Stylesheet for Both Print and HTML</title>
<para>A DSSSL <sgmltag>style-sheet</sgmltag> consists of one or more <sgmltag>
style-specification</sgmltag>s. This allows one to build a single stylesheet
that can format with either the print or HTML backends.</para>
<para>All you need is a customization skeleton that looks like this:</para>
<screen><!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl>
]]>
]>
<style-sheet>
<style-specification id="print" use="docbook">
<style-specification-body>
;; customize the print stylesheet
</style-specification-body>
</style-specification>
<style-specification id="html" use="docbook">
<style-specification-body>
;; customize the html stylesheet
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet></screen>
<para>If this is <filename>both.dsl</filename>, I can format my document using
the print stylesheet by running<screen>jade -t rtf -d both.dsl#print file.sgm
</screen>and using the HTML stylesheet by running<screen>jade -t sgml -ihtml both.dsl#html file.sgm
</screen>which is kindof neat. (I've built some additional machinery on top
of this to make the selection automatic from within <ulink url="http://www.arbortext.com/">
ADEPT</ulink> and a shell script that I use.)</para>
<para>
An alternative method for doing this is simply to use marked sections
in the stylesheet, like this:
<screen><!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE">
<![%html;[
<!ENTITY % print "IGNORE">
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA dsssl>
]]>
<!ENTITY % print "INCLUDE">
<![%print;[
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA dsssl>
]]>
]>
<style-sheet>
<style-specification use="docbook">
<style-specification-body>
;; common customization can go here
<![%print;[
;; customize the print stylesheet here
]]>
<![%html;[
;; customize the html stylesheet here
]]>
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet></screen></para>
</sect1>
<sect1>
<title>Customizing the Title Page</title>
<para>Titlepages are controlled by several variables:<variablelist>
<varlistentry>
<term><literal>%generate-<replaceable>element</replaceable>-titlepage%</literal></term>
<listitem><para>Controls whether or not a titlepage is generated. If, for
example, <literal>%generate-book-titlepage%</literal> is true, a titlepage
will be generated for <sgmltag>Book</sgmltag>s.</para>
</listitem></varlistentry>
<varlistentry>
<term><literal><replaceable>element</replaceable>-titlepage-recto-elements
</literal></term><listitem><para>Specifies the elements which should occur
on the titlepage recto. This variable is a list of GIs. For example, if <literal>
book-titlepage-recto-elements</literal> is <literal>'("TITLE" "SUBTITLE" "AUTHOR")
</literal>, then the <sgmltag>Title</sgmltag>, <sgmltag>SubTitle</sgmltag>,
and <sgmltag>Author</sgmltag> elements in the division or component's <sgmltag>
*Info</sgmltag> element will appear on the <sgmltag>Book</sgmltag>'s titlepage
recto.</para>
</listitem></varlistentry>
<varlistentry>
<term><literal><replaceable>element</replaceable>-titlepage-verso-elements
</literal></term><listitem><para>Specifies the elements which should occur
on the titlepage verso.</para>
</listitem></varlistentry>
<varlistentry>
<term><literal>%titlepage-in-info-order%</literal></term><listitem><para>
The content of the titlepage is drawn from the <sgmltag>*Info</sgmltag> element
at the beginning of a division or component. If <literal>%titlepage-in-info-order%
</literal> is true, the elements on the titlepage will occur in the order
in which they appear in the <sgmltag>*Info</sgmltag> element. Otherwise, the
elements occur in a fixed order given by the <literal><replaceable>element
</replaceable>-titlepage-<replaceable>side</replaceable>-elemnts</literal>.
</para>
</listitem></varlistentry>
<varlistentry>
<term><literal>%generate-<replaceable>element</replaceable>-toc-on-titlepage%
</literal></term><listitem><para>For some elements, such as <sgmltag>Part
</sgmltag>s, it may make sense to place the TOC for that element (if it is
generated) on the same page sequence as the titlepage. If <literal>%generate-<replaceable>
element</replaceable>-toc-on-titlepage%</literal> is true, that's what will
be done.</para>
</listitem></varlistentry>
<varlistentry>
<term><literal>%generate-partintro-on-titlepage%</literal></term><listitem>
<para><sgmltag>Part</sgmltag>s and <sgmltag>Reference</sgmltag>s can begin
with a <sgmltag>PartIntro</sgmltag>. If <literal>%generate-partintro-on-titlepage%
</literal> is true, the content of the <sgmltag>PartIntro</sgmltag> will occur
on the same page sequence as the titlepage.</para>
</listitem></varlistentry>
</variablelist></para>
<para>The most common customization is probably setting <literal>%generate-<replaceable>
element</replaceable>-titlepage%</literal> to true and changing the list of
elements in <literal><replaceable>element</replaceable>-titlepage-recto-elements
</literal> and <literal><replaceable>element</replaceable>-titlepage-verso-elements
</literal></para>
<para>There are a few other functions that you may wish to change:<variablelist>
<varlistentry>
<term><literal>(<replaceable>element</replaceable>-titlepage-before node side)
</literal></term><listitem><para>This function is called before each new type
of element on the titlepage (before the first <sgmltag>Title</sgmltag>, before
the first <sgmltag>SubTitle</sgmltag>, etc.). The <literal>node</literal>
will contain the element that will appear on the titlepage next and <literal>
side</literal> will be either <literal>'recto</literal> or <literal>'verso
</literal>.</para>
</listitem></varlistentry>
<varlistentry>
<term><literal>(<replaceable>element</replaceable>-titlepage-<replaceable>
component</replaceable> node side)</literal></term><listitem><para>This function
is called for each element on the titlepage. For example, the <sgmltag>Abstract
</sgmltag> on a <sgmltag>Book</sgmltag> titlepage is printed by the <literal>
book-titlepage-abstract</literal> function.</para>
</listitem></varlistentry>
</variablelist></para>
</sect1>
<sect1>
<title>Using the Stylesheets with XML</title>
<para>This is just a placeholder. This needs to be written. Basically, you
just need to use <filename>catalog</filename> files to make sure that the
XML instances and the stylesheets get parsed with the correct declarations.
</para>
</sect1>
</chapter>
|