XML technologies / DocBook / The DocBook XSL stylesheets / Customizing DocBook XSL stylesheets / Passing parameters through the XSLT processor
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
Every XSLT processor provides an option to override stylesheet parameters. This has the following advantages:
Parameters are easy to change: you only need your XSLT processor and the parameter’s name and value.
Small changes require no customization file.
Effects can be tested quickly.
Parameters can still be combined with a customization file.
For example, to link an HTML file to a CSS file, use the parameter html.stylesheet. For xsltproc:
xsltproc --stringparam html.stylesheet "user.css" ... For Saxon use the following syntax:
saxon ... html.stylesheet="'user.css'"Saxon expects parameters in single quotes, interpreted as strings. If several parameters are needed, specify each as a Parameter=Wert expression. For xsltproc use the option for strings --stringparam or, for numeric values, the option --param. Confusing these options may pass a number as a string, producing unwanted results.
This method also lets you pass several parameters to the stylesheet. Too many become unwieldy, however, so a customization file is preferable.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top