4. The build process

Table of Contents

4.1. Introduction and overview
4.2. Running ant
4.3. ant properties
4.4. Phase one build
4.5. Phase two build
4.6. File upload
4.6.1. Uploading with ant

4.1. Introduction and overview

Building a Website consists of three steps.

  1. Resolving the web links and file identities (layout)

  2. Building the html files, by transforming the XML files into html

  3. Uploading the built files (and any other referenced files) from your hard disk to the server from which they will be accessed by readers of your Website.

Before describing the detail, a quick overview. The build tool I've chosen for this example is ant, a build tool that has developed over the years and is both popular and very flexible. It 'hides' the details of what is happening, yet can be understood by someone with a modest understanding of xml. See Appendix A for a link to the ant Website.

Phase one runs first to create a map of the files and connections between them. Figure 2 shows this

Figure 2. Phase one. Map generation

Phase one

Phase one. Map generation


This process (layout), produces an intermediary file named autolayout.xml (so don't create one yourself with that name!) which is a subtle variation on the layout.xml file that you created. The XSLT transform also checks that your XML files have an id value and one or two other checks are performed.

[Warning]When to run phase one of the build

A key point in the build process is to note that each time layout.xml is changed, this phase of the build process needs to be run. On the other hand, if you are only modifying the file content of one of your xml files, it is not necessary to run this phase. Section 4.2 shows how to select a particular part of the build using ant.

The next task is to generate the html, from the xml files, using the standard Docbook stylesheets. Figure 3 shows this

Figure 3. Phase two. Building the site.

Phase two.

Phase two. Building the site


This step uses the main Website XSLT stylesheets. If you need to customize (for which see Section 6) the stylesheet processing in any way, then use a file like mywebsite.xsl which is really a stepping stone to the main Website XSLT stylesheet. If you don't need customization this should be a very simple file which does one job, to call in the main chunk-website.xsl file which is part of the Website distribution. The output of this phase of the process is a series of html files (one for each of your xml files) which are placed according to your layout, as specified in layout.xml. Once you have run this step, go take a look in your designated output directory!

The final phase is an file transfer protocol (ftp) transfer of the files created in phase two up to your server. For this document I have used an extension feature of the ant process. Alternatives are to use something like fireftp, a plugin for the Firefox browser, or any free or commercial ftp program. Once you have set up an 'account' (a name, password and remote server), the operation is simply to connect to the site and transfer the files, adding or replacing existing ones as necessary. The graphical interfaces generally list two windows. One on your local disk, one on the remote server. All you have to do is drag and drop from one to the other. Some may ask you if it's OK to overwrite files (very common since you may be modifying the same files many times, for example, your section headings where the table of content is created automatically by Website). I find fireftp a convenient method, although to transfer many files, ant may be more appropriate.

That's the overview, now for the detail