[liblouis-liblouisxml] Re: Dividing a Book Into Volumes

  • From: Christian Egli <christian.egli@xxxxxxxx>
  • To: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • Date: Mon, 17 May 2010 15:45:48 +0200

"John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx> writes:

> Each volume will also need a title page and an end-of-volume notice. 
> These could be files specified by the configuration setings volumeStart 
> and VolumeEnd Some things within these files will have to be changed 
> from volume to volume, such as the volume number and the beginning and 
> ending braille and print numbers. I am uncertain how this will be done. 
> xslt could be used, but this would introduce a dependency on another 
> library. There is probably a simpler method.

Some form of templating will be needed. XSLT is of course a standard and
well known method (and readily available). I'm not that worried about
the additional dependency, especially since it is for liblouisxml which
is less likely to be deployed on embedded devices. However I agree that
xslt might be a bit heavy if all you need is some form of variable
replacement. You could for example define a number of variables (such as
volume_number) place them within some markers ( maybe "{% volume_number
%}") and have a sed process which just replaces all these with the value
of volume_number. Of course you'd have to implement this in C which is
tedious (if you refrain from using third party libraries for the
purpose).

In the end it comes down to balance the pros and cons of an xslt based
solution versus a custom made minimal templating solution.

A custom solution adds a lot of code and has to be maintained and
documented while a xslt based solution uses standard technology which is
documented everywhere.

Hope that helps
Christian
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland
For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: