XML technologies / DocBook / Conditional elements (profiling) / Applying multiple profiling criteria / Multiple profiling attributes, multiple values
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
DocBook allows multiple attributes on an element. A document for several operating systems could therefore include an additional attribute userlevel to distinguish users from administrators. Starting from the example profiling-book-001.xml this information can be included as follows:
Example: profiling-book-002.xml
<book>
<chapter>
<title>Installation</title>
<section os="linux" userlevel="user;admin">
<title>Installationsmedium</title>
<para>Die Installation unter Linux...</para>
<para userlevel="admin">Für den Admin ...</para>
</section>
<section os="win" userlevel="user;admin">
<title>Installationsmedium</title>
<para>Die Installation unter Windows.</para>
<para userlevel="admin">Weiteres für den Admin.</para>
</section>
<section userlevel="user;admin">
<title>Hilfe</title>
<section userlevel="admin">
<title>Einrichten der Hilfe</title>
<para>Wie man die Hilfe einrichtet.</para>
</section>
<section userlevel="user">
<title>Wo finde ich was?</title>
<para>...</para>
</section>
</section>
</chapter>
</book>This document has four variants: user documentation for Linux and Windows, and administrator documentation for Linux and Windows. The matrix below shows the parameters needed to produce each variant:
OS | User | Administrator |
Linux | | |
Windows | | |
To produce the Linux user documentation, find the corresponding intersection in the table to obtain the required parameters. The command is therefore:
xsltproc --stringparam profile.os "linux" \
--stringparam profile.userlevel "user" \
html/profile-docbook.xsl \
prof-book-002.xmlThis command produces the following file; redundant blank lines have been collapsed:
<?xml version="1.0" ?>
<book>
<chapter>
<title>Installation</title>
<section os="linux" userlevel="user;admin">
<title>Installationsmedium</title>
<para>Die Installation unter Linux.</para>
</section>
<section userlevel="user;admin">
<title>Hilfe</title>
<para>Wie man die Hilfe einrichtet.</para>
<section userlevel="user">
<title>Wo finde ich was?</title>
<para>...</para>
</section>
</section>
</chapter>
</book>
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