Chapter 4. Customization

Table of Contents

HR-XSL Customization
Stylesheet Parameters
Localized Messages
DocBook XSL Customization
Stylesheet Parameters
Cascading Style Sheets

Generating a CV or résumé with HR-XSL is, internally, a two-stage process. First, HR-XSL generates a DocBook version of your original file; second, this DocBook file is transformed into a PDF, HTML, or plain text version. Thus, to fully control the look of your CV or résumé, you must change two different sets of parameters. For content modifications (e.g., names of headings, date format, etc.), you would customize the HR-XSL transformation. For appearance modifications (e.g., font sizes, whether page numbers are displayed, etc.), you would customize the DocBook transformation. The following sections describe these two customizations in detail.

HR-XSL Customization

There are two ways to customize the HR-XSL transformation: stylesheet parameters and localized messages.

Stylesheet Parameters

XSL stylesheets can change their behavior based on user-specified parameters. For example, a parameter such as ulink.footnotes, when set to true, would tell the stylesheet to display the URL of every link as a footnote.

To specify a parameter, use the <xsl:param> element. For example:

<xsl:param name="ulink.footnotes" select="true"/>

If you are using the included HR-XSL helper script (util/hr-xsl.xml), you simply add these elements to a file called parameters.xsl, then place this file in the same directory as your build script. Refer to the examples in the HR-XSL distribution (in the examples directory) to see how this is done.[3]

To use a different file name, specify a value for the parameters.file property when launching Ant. For example:

ant -Dparameters.file=myfile.xsl

Table 4.1, “HR-XSL Stylesheet Parameters” lists the parameters that can be used in HR-XSL. (Currently, there is only one parameter, but future versions of HR-XSL should offer more.)

Table 4.1. HR-XSL Stylesheet Parameters

ParameterDescriptionPossible Values
month.formatFor date elements, this parameter indicates how the month should be displayedshort an abbreviated month, such as “Sep.”; long the full month name

Localized Messages

All of the HR-XSL stylesheets have been localized. Simply stated, this means you can easily change the output of HR-XSL to a different language.

HR-XSL currently provides translations for English and Italian. To change the output language to one of these translations, set the lang parameter so that it matches one of the filenames in the xsl/common/messages directory of the HR-XSL distribution. For example, to change to Italian, add the following line to your parameters.xsl file:

<xsl:param name="lang" select="'it'"/>

You will also need to specify the same language for DocBook's l10n.gentext.default.language parameter so that DocBook-specific messages, such as the table of contents title, are translated as well. For example:

<xsl:param name="l10n.gentext.default.language">it</xsl:param>

For languages that HR-XSL does not provide, you can create your own. To do so, go to the xsl/common/messages directory and make a copy of the en.xml file, giving it a name that represents your language. For example, if you want to create a French localization, you should use the two-letter language code for French (“fr”). You can then edit this new fr.xml file and translate each English message to its French equivalent. Finally, you can tell HR-XSL to use this translation by setting the lang parameter as shown above.[4]



[3] If for some reason you are not using the included helper script, you will need to create a customization layer and add your parameters there. See the customization-layer.xsl file in the util directory for an example.

[4] If you have created a localization file for your language, please consider submitting it to the HR-XSL maintainer so that it can be included in the distribution for others to use.