I nternational

    V irtual

    O bservatory

A lliance

IVOAPub - A system for creating IVOA documents
Version 1.0

IVOA Note 2011-05-16

This version:
1.0
Latest version:
not issued outside GWS-WG
Previous version(s):
None
Author(s):
Paul Harrison

Abstract

This note describes software designed to assist in creating IVOA documentation conforming to the IVOA documentation standards [std:docSTD].

Status of This Document

This is an IVOA note expressing suggestions from and opinions of the authors. It is intended to share best practices, possible approaches, or other perspectives on interoperability with the Virtual Observatory.

A list of current IVOA Recommendations and other technical documents can be found at http://www.ivoa.net/Documents/.

Acknowledgements

The document transformations described in this document are derived from similar transformations created by Norman Gray and Ray Plante.

Contents

1. Introduction

This document describes an XSL based document processing system.

1.2. Features

The main features of the system are listed below and are described in section 3.

  • automated section numbering and table of contents generation
  • automated reference handling with bibtex.
  • formatting of included XML files.
  • generation of schema documentation according to uniform standards.
  • final output of IVOA mandated PDF file with associated pdf bookmarks.

Several of these features allow for more accurate authoring of documents, avoiding errors that can creep in when only manual editing is available. For instance the facility to be able to include and format raw XML files means that not only can the original XML files be independently validated, but also there are no errors in the complex process of pasting XML into a document whilst trying to maintain formatting.

2. Installation

The scripts are maintained and indended to be distributed from the GoogleCode Volute repository at http://code.google.com/p/volute/source/browse/#svn%2Ftrunk%2Fprojects%2Fivoapub%2Fivoadoc. The primary method of use is envisaged to be via the svn externals mechanism within other projects in the Volute repository.

svn propset svn:externals 'ivoadoc https://volute.googlecode.com/svn/trunk/projects/ivoapub/ivoadoc' .

2.1. Prerequisites

The bulk of the processing is done with version 2.0 XSL Transformations [std:XSL2], which means that an XSL 2.0 processor must be installed. Virtually the only fully capable XSLT 2.0 processor avalable is Saxon [saxon], which itself is written in Java so that a java runtime must also be installed. The scripting engine that is used to drive the processing is Ant [ant] which must also be installed. The version of Java that should be used is Java 1.6 or newer, and the version of Ant should not be too critical, but any recent version e.g. 1.6 or greater should suffice. The version of Saxon that is used is more complex, as this now has several variants including commercial offerings - the free version that still has all the required functionality is Saxon-B version 9.1 (note that this is not the most recent free version of Saxon). There are several ways in which Saxon can be made available for running within Ant, but perhaps the simplest is to install the jar file in the $HOME/.ant/lib/ directory.

The production of the PDF version of the document is done using the Apache FOP system [FOP]. A binary version of the FOP distribution should be downloaded, and its location set as the fop.home variable in the ant build.xml file.

To use the bibliography feature then LaTeX and BibTex need to be installed.

 

3. User Guide

In order to take advantage of the various features of the IvoaPub system the input file needs to be valid XHTML with some extra DIV delimited structure that denotes where sections start and end. These DIVs can be nested to create sub-sections, and sub-sub-sections in a properly structured fashion rather than relying on the level of the HTML heading tag (H1, H2 H3, etc) to denote the level.

If starting afresh, then there is a template.html file that has the appropriate structuring with some example sections, as well as other standard elements in an IVOA document. If you already have a document that needs to have the DIV structuring added, there there is a python script structure.py that can be used to add the DIV tags dependent on the already existing heading tags. It is likely that you will have to do some customization of the structure.py script (which uses a SAX [SAX] processing model) to alter when the DIV wrapping should occur.

The various different features can be invoked with the Ant build script in the following ways

  1. ant without any arguments will run the default ivoarestructure.xslt transformation which causes
    • Section renumbering and regeneration of the table of contents
    • cross references to be updated.
    • XML files to be re-included.
    • schema documentation to be regenerated.
  2. ant biblio will regenerate the bibliography (which has to be manually included).
  3. ant createPDF with generate the PDF version.
  4. ant package will zip up the HTML and PDF versions of the document and associated files.

After running the script, the same section will look like

<div class="section">
<h3>
<a id="d2e144" shape="rect"/>
<span class="secnum">1.1. </span>
Subtitle
</h3>
<p>text</p>
</div>

It should be noted that a link anchor has been automatically created with an autogenerated identifier - if it is desired this can be changed to a more memorable value (to make authoring a cross reference easier for instance) and the new value will be used in the next iteration of contents generation.

The location of the table of contents itself is indicated by a ToC processing instruction located within a DIV tag, as shown below

<div>
<?toc ?>
</div>

As with other features that use a processing instruction to indicate where some special processing should take place, all text within the enclosing DIV is replaced by the processing.

 

4. Troubleshooting & FAQ

4.3. I do not want all my XML includes to be redone

If you do not want an include to be redone in a document formatting cycle, then you need only to comment out or remove the processing instruction that would cause the inclusion - the already included/formattig XML will not be touched.

 

Appendix A. Full Template

The full template document

<!-- $Id$ Note that this file should be xhtml with div to mark sections - see README for more information Paul Harrison -->
<html xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:="http://www.w3.org/1999/xhtml">
<head>
<title>Template IVOA Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta name="Title" content="IVOA WG Internal Draft"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="author" content="Paul Harrison, paul.harrison@manchester.ac.uk"/>
<meta name="maintainedBy" content="Paul Harrison, paul.harrison@manchester.ac.uk"/>
<link href="http://www.ivoa.net/misc/ivoa_a.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="http://www.ivoa.net/misc/ivoa_wd.css" type="text/css"/>
<style type="text/css" xml:space="preserve"/>
<link href="./ivoadoc/XMLPrint.css" rel="stylesheet" type="text/css"/>
<link href="./ivoadoc/ivoa-extras.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="head">
<div id="titlehead" style="position:relative;height:170px;width: 500px">
<div id="logo" style="position:absolute;width:300px;height:169px;left: 50px;top: 0px;">
<img src="http://www.ivoa.net/pub/images/IVOA_wb_300.jpg" alt="IVOA logo"/>
</div>
<div id="logo-title" style="position:absolute;width:200px;height:115px;left: 320px;top: 5px;">
<p>
<b>
<i>
<span style="font-size: 14pt; color: #005A9C;"> I</span>
</i>
</b>
<i>
<span style="font-size: 14pt; color: #005A9C;">nternational</span>
</i>
</p>
<p>
<b>
<i>
<span style="font-size: 14pt; color: #005A9C;">    V</span>
</i>
</b>
<i>
<span style="font-size: 14pt; color: #005A9C;">irtual</span>
</i>
</p>
<p>
<b>
<i>
<span style="font-size: 14pt; color: #005A9C;">    O</span>
</i>
</b>
<i>
<span style="font-size: 14pt; color: #005A9C;">bservatory</span>
</i>
</p>
<p>
<b>
<i>
<span style="font-size: 14pt; color: #005A9C;">A</span>
</i>
</b>
<i>
<span style="font-size: 14pt; color: #005A9C;">lliance</span>
</i>
</p>
</div>
</div>
<h1>
Title
<br/>
Version
<span class="docversion">0.1</span>
</h1>
<h2>IVOA Internal Working Draft @RELEASEDATE@</h2>
<dl>
<dt>Working Group</dt>
<dd>
<a href="http://www.ivoa.net/twiki/bin/view/IVOA/IvoaGridAndWebServices" shape="rect">http://www.ivoa.net/twiki/bin/view/IVOA/IvoaGridAndWebServices</a>
</dd>
<dt>
<b>This version:</b>
</dt>
<dd>
<span class="docversion">0.1</span>
</dd>
<dt>
<b>Latest version:</b>
</dt>
<dd> not issued outside GWS-WG</dd>
<dt>
<b>Previous version(s):</b>
</dt>
<dd> Internal Working Draft v0.1, 2005-01-24 Internal Working Draft v0.2, 2006-05-11 Internal Working Draft v.0.3, 2007-04-26 Internal Working Draft v.04 2008-05-10</dd>
<dt>
<b>Author(s):</b>
</dt>
<dd> Paul Harrison</dd>
</dl>
<h2>Abstract</h2>
<p>Blah Blah</p>
<h2> Status of This Document</h2>
<p>This is an working draft of the GWS-WG. The first release of this document was on 2005-01-24 within the working group; This version is the first public WD.</p>
<p>
<em>This is an IVOA Working Draft for review by IVOA members and other interested parties. It is a draft document and may be updated, replaced, or made obsolete by other documents at any time. It is inappropriate to use IVOA Working Drafts as reference materials or to cite them as other than “work in progress”.</em>
</p>
<p>
<em>A list of </em>
<span style="background: transparent">
<a href="http://www.ivoa.net/Documents/" shape="rect">
<i>current IVOA Recommendations and other technical documents</i>
</a>
</span>
<em> can be found at http://www.ivoa.net/Documents/.</em>
</p>
<h2 class="prologue-heading-western">Acknowledgements</h2>
<p>blah</p>
</div>
<h2>Contents</h2>
<div>
<?toc ?>
</div>
<div class="body">
<div class="section">
<h1>
<a id="Introduction" shape="rect"/>
Introduction
</h1>
<p> </p>
<div class="section">
<h2>Subtitle</h2>
<p>subtext</p>
<p>
A citation can begin like
<cite>std:RM</cite>
</p>
</div>
<div class="section">
<h2> Subtitle</h2>
<p>subtext</p>
</div>
</div>
<div class="section">
<h1> Section</h1>
<div class="section">
<h2> Subsection</h2>
<p>Subsection blah</p>
<div class="section">
<h3>SubSubSection</h3>
</div>
<p>subsubsection blah</p>
</div>
</div>
<div class="section">
<h3> Section</h3>
<p>blah blah</p>
</div>
</div>
<div class="appendices">
<div class="section">
<h1>An appendix</h1>
<p>Include some xml.</p>
<div>
<?incxml href="http://www.ivoa.net/xml/VOResource/VOResource-v1.0.xsd"?>
</div>
</div>
</div>
<div class="section-nonum">
<h1>
<a name="References" id="References" shape="rect"/>
References
</h1>
<?bibliography ivoadoc/refs.bib ?>
</div>
<hr/>
<p style="text-align: right; font-size: x-small; color: #888;"> $Revision$ $Date$ $HeadURL$ </p>
</body>
</html>

References

[std:docSTD] R. .J. Hanisch, C.Arviset, F. Genova, and B. Rino.
Ivoa document standards, version 1.2. {IVOA Recommendation}, 2010.
[ant] http://ant.apache.org/.
Apache ant. [Online].
[saxon] http://saxon.sourceforge.net/.
Saxon. [Online].
[SAX] http://www.saxproject.org/.
SAX. [Online].
[FOP] http://xmlgraphics.apache.org/fop/.
Apache FOP. [Online].
[std:XSL2] Michael Kay, editor.
{XSL} transformations ({XSLT}) version 2.0. {W3C Recommendation}, January 2007.

$Revision$ $Date$ $HeadURL$