XML technologies / DocBook / Conditional elements (profiling) / Profiling for custom attributes
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
The predefined profiling attributes should suffice in most cases. If you have customized DocBook and added new attributes, you can profile those too. Here is an example:
Example: profiling-book-003.xml
<book>
<chapter>
<title>Installation></title>
<section os="linux">
<title>Installationsmedium</title>
<para>Die Installation unter Linux.</para>
</section>
<section>
<title>Hilfe</title>
<para foo="a">Hier steht etwas nur für a.</para>
<para foo="b">Hier steht etwas nur für b.</para>
</section>
</chapter>
</book>To retain all elements whose foo attribute has the value a, you need the parameters profile.attribute and profile.value:
xsltproc --stringparam profile.attribute "foo" \
--stringparam profile.value "a" \
profiling/profile.xsl profiling-book-003.xmlThe result is:
<book>
<chapter>
<title>Installation></title>
<section os="linux">
<title>Installationsmedium</title>
<para>Die Installation unter Linux.</para>
</section>
<section>
<title>Hilfe</title>
<para foo="a">Hier steht etwas nur für a.</para>
</section>
</chapter>
</book>As expected, the attribute value b does not appear in the output.
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