Skip to main content

Section 27.1 Publisher File

As of 2021-01-23 we are well along on a transition to providing options a publisher would choose via an XML publisher file. Here we describe how to create and employ this file. Details on actual options can be found throughout this guide, with terse comprehensive reference material in Chapter 41. Note too, that Section 27.5 describes the old method (which is still in use, but will eventually be obsolete).

Create a separate XML file the same way you always would. Include the usual XML declaration as the first line. Now, instead of the overall element being <pretext>, use <publication>. That's it. Various elements within <publication> will be used to specify options, typically attributes. Name the file something that reminds you of its purpose, such as pod.xml for a print-on-demand version.

Entries that control aspects of the output are often attributes of various elements, but may also be the content of elements. When you read the reference material in Chapter 41 be aware that we use a sort of shorthand to describe these entries, modeled on a specification called XPath. For example, if we say to set

/publication/foo/bar/@bazz

to possible values of yes, no, or maybe then the following will be the guts of a legitimate publisher file that would somehow adjust your output in some way. In particular, note that the “at sign”, @, indicates an attribute of the preceding element.

<publication>
    <foo>
        <bar bazz="maybe"/>
    </foo>
</publication>

To employ the file, you specify its filename on the xsltproc command line using a string parameter (Section 27.5) named publisher. This should have a path that is relative to the main file for the document. For example, assuming pod.xml and fauna.xml are in the same directory

xsltproc -stringparam publisher pod.xml pretext-html.xsl aota.xml

This file should reduce the many other string parameters in use, and reduce the need for extra XSL files (Section 5.6).