This appendix demonstrates how DocBook tags are used and what their effect is (useful for testing how they render to other formats). This is a DocBook cookbook - it is it intended to be a complete DocBook reference. For a more complete description of how docbook may be used see here. If there is anything that is NOT clear in this documentation ask and if you think that you can make it clearer then change the document accordingly.
It is useful to use entities as variables for information that will
change from one documentation version to the next. For instance we can use
&ODVerNum; to provide the current version of the OGSA-DAI distribution -
in this instance this is set to 3.0. Entities are stored in a file
called globalentities. Use of this potentially could allow
for certain pieces of information to be rapidly changed from one version of the
documentation to the next. However,care must be taken when using this - if you
say anything that pertains to a specific version of the documentation then it
should NOT use such a variable.
Currently documentation is processed using xsltpro.
This is invoked through a Makefile with a number
of targets: all, developer,
user and product. These are
different views of the documntation. The all view
is supposed to incorporate content from all the other files. There is
also also a clean target that
removes all the output files produced. Output of the content goes into
the Output directory in a directory corresponding
to one of the above targets with an html subdirectory where the rendered
content can be found. Later, hope to have pdf, xhtml, etc. views of the
documentation.
![]() | Caution |
|---|---|
This section is out of sync with what is actually in the file system. Will be updated or removed. |
The directory structure for the documentation is as follows:
doc +
|
DocBook +
|
Administrator
|
Developer
|
Misc
|
Output
|
User
|
images
|
css
|
xsl-stylesheets
Directory containing files pertaining to the Administration view of the OGSA-DAI documentation. | |
Directory containing files pertaining to the Developer view of the OGSA-DAI documentation. | |
Directory containing files pertaining to a general view of the OGSA-DAI documentation. | |
Output directory where the processed conent will go. | |
Directory containing files pertaining to the User view of the OGSA-DAI documentation. | |
Directory containing image files. | |
Directory containing css files for the html produced. These are the same as used for the OGSA-DAI web site with a couple of additions for DocBook generated content. | |
Directory containing the XSL files produced by Norman Walsh available from the DocBook Source Forge project. The version currently being used is 1.72.0. |
There are a number of content files which are:
Contains pointers to the User view of the documentation. Corresponding files are contained in the User subdirectory and some from the Misc subdirectory which have more general scope.
Contains pointers to a Developer orientated view of the the documentation. Most of the relevant files are in the Developer subdirectory.
Has an administrator view of the documentation. Files are in the Administrator subdirectory.
Contains all the documentation but processing at the moment is clobbering files so only the Developer view is coming out.
Is another view of the documentation.
These include other files using xinclude (see below) to pull in a number of files stored in the above directories to for documentation views.
Each of the files stored in the sub directories constitutes a chapter. That is the current granularity of the decomposition - at some future point it may be worthwhile having a section to a file but we shall see how well the current set up works.
Typically each of the chapter files has the following structure:
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
[
<!-- Global entities file -->
<!ENTITY % myents SYSTEM "../globalentities">
%myents;
]>
<!-- Need a unique id for a chapter -->
<chapter id="UniqueChapterID">
<title>Title for my Chapter</title>
<!-- Index entries are optional but it could be useful for navigation.
Secondary index is optional. -->
<!-- Each section needs to have a unique id -->
<section id="UniqueSecId">
<title>Section Title</title>
<!-- nested sections become subsections and so on. -->
<section id="SubSecId">
<title>This is a sub section</title>
<para>
Some content at last ...
</para>
</section>
</section>
</chapter>
Xinclude allows the document to be broken up into smaller chunks using files that are included into the main document. To do this use:
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="FileToBeIncluded.xml" />
Currently the granularity of the decomposition is done at chapter level. It may be advantageous at some later point to break this down to sections but we shall see how the present granularity works.
Problem with this set-up is that if, for some reason, your document fails
to process then it will not be included in the final documentation. Unless
you pay attention to the error messages and warnings this will happen
silently. For that reason you can put a
xi:fallback that will complain if this
happens:
<xi:include
xmlns:xi="http://www.w3.org/2001/XInclude"
href="FileToBeIncluded.xml">
<xi:fallback>
<warning>
<para>
Failure to include FileToBeIncluded.xml. Please fix!
</para>
</warning>
</xi:fallback>
</xi:include>
This way you will have some warning that something has gone wrong.
More information on xinclude is available here.
To list a piece of code use:
<para> <programlisting> Code would go here </programlisting> </para>
Which is rendered as:
Code would go here
Note that any ‘<’ would have to be turned into the appropriate entitity, < in this case. Alternatively you could put your code in a CDATA section:
<programlisting><![CDATA[
Code goes here
]]>
</programlisting>
This then does not need any special characters to be escaped.
Some hints about changing the typography of text:
For italicized text use <emphasis>...<emphasis>.
For bold text use <emphasis role="strong"> ...<emphasis>.
For type script <computeroutput>...<computeroutput>
or filename or <filename>...<filename>. For large blocks of
text use <screen>...</screen>.
To use bullet lists:
<itemizedlist>
<listitem>
<para>
item 1
</para>
</listitem>
<listitem>
<para>
item 1
</para>
</listitem>
</itemizedlist>
Which renders as:
item 1
item 1
To use bullet lists:
<orderedlist>
<listitem>
<para>
item 1
</para>
</listitem>
<listitem>
<para>
item 1
</para>
</listitem>
</orderedlist>
Which renders as:
item 1
item 1
You can specify the type of numbering by adding a numeration attribute with one of the following:
arabic giving 1, 2, 3, ...
loweralpha giving a, b, c, ...
lowerroman giving i, ii, iii, ...
upperalpha giving A, B, C, ...
upperroman giving I, II, III, ...
A definition list
<variablelist>
<varlistentry>
<term>Definition term goes here</term>
<listitem><para>And definition/description goes here</para></listitem>
</varlistentry>
<varlistentry>
<term>Another term goes here</term>
<listitem><para>And more stuff goes here</para></listitem>
</varlistentry>
</variablelist>
which is rendered as:
And definition/description goes here
And more stuff goes here
More information on lists is available here.
To add an image use:
<figure id="ODLogo"> <title>This is the title for the OGSA-DAI Logo.</title> <mediaobject> <imageobject role="html"> <imagedata fileref="images/ogsadai-medium.gif" align="center" /> </imageobject> <textobject> <phrase>This goes in the image ALT tag.</phrase> </textobject> <caption> Hector is the OGSA-DAI logo caption. </caption> </mediaobject> </figure>
which produces:
![]() | Important |
|---|---|
Currently should place any images in the For images use the titles to produce captions and not the caption element. |
![]() | Note |
|---|---|
Caption (title element) rendering is not centred. This worked ok with the xsl stylesheets
version 1.69 but the image did not (it did not display because an issue with
using xinclude). Currently this is being done using
a css rule (p.title in |
The recomended image package to use for images is DIA.
Some guidelines about layout:
Ensure layout is consistent, e.g. service components on the right clients on the left, etc.
Consistent colouring of components.
Keeping the diagram sources.
More informtion on images is available here.
To add an informal table you can use the following pattern:
<informaltable align="center">
<tgroup cols="3">
<thead>
<row>
<entry>header1</entry>
<entry>header2</entry>
<entry>header3</entry>
</row>
</thead>
<tbody>
<row>
<entry>a1</entry>
<entry>b1</entry>
<entry>c1</entry>
</row>
<row>
<entry>a2</entry>
<entry>b2</entry>
<entry>c2</entry>
</row>
<row>
<entry>a3</entry>
<entry>b3</entry>
<entry>c3</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Which renders as:
| header1 | header2 | header3 |
|---|---|---|
| a1 | b1 | c1 |
| a2 | b2 | c2 |
| a3 | b3 | c3 |
![]() | Note |
|---|---|
Centering of tables being done in |
You can add formal tables which also provide captions or titles (not both) in a document as well which can appear in a list of tables (note for the table example below you can only use a title and not a caption).
<table frame='all' id="SampleTable"><title>Sample Table.</title> <tgroup cols='5' align='left' colsep='1' rowsep='1'> <colspec colname='c1'/> <colspec colname='c2'/> <colspec colname='c3'/> <colspec colnum='5' colname='c5'/> <thead> <row> <entry namest="c1" nameend="c2" align="center">Horizontal Span</entry> <entry>a3</entry> <entry>a4</entry> <entry>a5</entry> </row> </thead> <tfoot> <row> <entry>f1</entry> <entry>f2</entry> <entry>f3</entry> <entry>f4</entry> <entry>f5</entry> </row> </tfoot> <tbody> <row> <entry>b1</entry> <entry>b2</entry> <entry>b3</entry> <entry>b4</entry> <entry morerows='1' valign='middle'><para> <!-- Pernicous Mixed Content --> Vertical Span</para></entry> </row> <row> <entry>c1</entry> <entry namest="c2" nameend="c3" align='center' morerows='1' valign='bottom'>Span Both</entry> <entry>c4</entry> </row> <row> <entry>d1</entry> <entry>d4</entry> <entry>d5</entry> </row> </tbody> </tgroup> <caption>Here is a caption</caption> </table>
which renders as:
More information on using tables in DocBook available here. Syntax for for table and for informaltable.
To add links use:
<ulink url="http://www.ogsadai.org.uk">http://www.ogsadai.org.uk</ulink>
which then provides a link:
These can be in-lined in the main text.
There are a number of different ways that you can cross link across document elements:
Using xref: allows one to link to existing elements. One points to the corresponding id of the element you wish to link to:
<xref linkend="DBLinks"/>
Links to the beginning of the section Section O.11, “Adding Links”, note that replaces the section title. More complex behaviour is also possible, see here.
Using link: with the link tag you can specify your ownlink text:
<link linkend="DBLinks">linking section</link>
More info on syntax here.
Appears as linking section which points to the same location as the xref above.
More information on links at here.
One can add an index entry by placing the following markup in your content:
<indexterm> <primary>IndexEntry</primary> <secondary>Subentry</secondary> </indexterm>
The secondary entry is optional. One can add tertiary and other elements and see also elements. The index entry picks up the location it has to point to from the context of where it is placed - a good location might be after the section title. The result of this process can be viewed in the index for this document.
Glossary entries are stored in Misc/Glossary.xml.
To add an entry use:
<glossentry id="IdForTerm">
<glossterm>
DefinedTerm
</glossterm>
<glossdef>
<para>
Term definition
</para>
</glossdef>
</glossentry>
This can then be referenced from the main body of the text by using:
<glossterm linkend="IdForTerm">DefinedTerm</glossterm>
DocBook allows admonitions to be created to give warnings, tips, cautions, ..., etc. The colours used are determined in the default.css stylesheet.
<important> <para> Do not deliver results via SOAP. </para> </important>
Which renders to:
![]() | Important |
|---|---|
Do not deliver results via SOAP. |
while:
<warning> <para> Do not deliver results via SOAP. </para> </warning>
Gives:
![]() | Warning |
|---|---|
Do not deliver results via SOAP. |
and
<note> <para> Do not deliver results via SOAP. </para> </note>
gives:
![]() | Note |
|---|---|
Do not deliver results via SOAP. |
and
<tip> <para> Do not deliver results via SOAP. </para> </tip>
gives:
![]() | Tip |
|---|---|
Do not deliver results via SOAP. |
with:
<caution> <para> Do not deliver results via SOAP. </para> </caution>
giving:
![]() | Caution |
|---|---|
Do not deliver results via SOAP. |
Most of the options of how the DocBook is rendered into html are configured
in the custom.xsl file.
![]() | Note |
|---|---|
Some of the rendering of the html is produced by the css so
if some of the stuff you are producing does not quite look
right it is worth checking the files in |
One may often want to create conditional content with a document so that a section is only shown under certain conditions. In DocBook this is referred to as profiling. The attributes in the table below[6] can decorate almost all DocBook defined elements. These can then be used for conditional compilation to obtain particular views of the documentation.
| Attribute Name | Description |
|---|---|
| arch | Computer or chip architecture, such as i386. |
| condition | General purpose conditional attribute, with no preassigned semantics. |
| conformance | Standards conformance, such as lsb (Linux Standards Base). |
| lang | Language code, such as de_DE. |
| os | Operating system. |
| revision | Editorial revision, such as v2.1. |
| revisionflag | Revision status of the element, such as changed. This attribute has a fixed set of values to choose from. |
| role | General purpose attribute, with no preassigned semantics. Use with caution for profiling. |
| security | Security level, such as high. |
| userlevel | Level of user experience, such as beginner. |
| vendor | Product vendor, such as apache. |
For the purposes of this documentation we shall use the condition attribute to distinguish threads of the documentation that pertain to the release that works with Globus by assigning it the value daigt40 and the Axis version by assigning this attribute the value daiaxis1.
For example to specify that a list item or paragraph is for specific versions of OGSA-DAI you can do things like:
<para condition="daigt40"> For OGSA-DAI GT we do... </para> <para condition="daiaxis1"> For OGSA-DAI Axis we do... </para> <itemizedlist> <listitem condition="daigt40"> For OGSA-DAI GT we do... </listitem> <listitem condition="daiaxis1"> For OGSA-DAI Axis we do... </listitem> </itemizedlist> <phrase condition="daigt40"> <para> The phrase element is useful for grouping multiple elements relating to OGSA-DAI GT... </para> <para> Like this... </para> </phrase> <phrase condition="daiaxis1"> <para> And likewise for OGSA-DAI Axis... </para> <para> Like this... </para> </phrase>
There is also a daiall condition for content that should only be included when a complete document set is being produced not a set for specific platforms or versions of OGSA-DAI.
Profiling is not enabled by default - a different stylesheet has to be used to achieve
that: html/profile-chunk.xsl for an html rendering.
All elements will still be output unless the desired profiled sections are specified:
--stringparam profile.condition "daigt40"
in which case only those condition attributes which have a value of
daigt40 will be included. If the xref
or link elements are used in the documentation then a
two-phase process is required (which is a lot more complicate to describe so look at the
Makefile to see how it is done.
More information on profiling is available
here.
The following sources may provide further information about DocBook that may prove to be useful.
Docbook: The Definitive Guide is an OReilly book which is available on-line. This appears to be the standard reference for DocBook. In particular, there is an index of all the DocBook elements which can be useful.
DocBook XSL: The Complete Guide discusses how to XSL Transform your DocBook sources to other formats.
The HTML Parameter Reference discusses the option available of the XSL style sheets provided by Norman Walsh.
Globus Documentation Primer provides a good overview of DocBook elements. Most of this has been absorved into this guide.