Page 1 of 1

Exclude text from output

Posted: Fri Jun 11, 2010 5:33 pm
by burbles
I would like to mark text in DocBook 5 with several types of <phrase> tags and have the ability to specify that text as print only, web only or do not output when transformed:
e.g. <phrase condition="print"> will show the text in print output only (i.e. exclude that marked text from HTML output), or <phrase condition="web"> will show the text only in HTML output (i.e. excluded from FO transformation).
So, what is the XSL or FO code that would ignore (exclude) block text from output for these alternatives?

Re: Exclude text from output

Posted: Mon Jun 14, 2010 1:58 pm
by adrian

What you are looking for are the DocBook profiling stylesheets.

You can find them as follows:
- FO(PDF) - [oxygen_folder]/frameworks/docbook/xsl/fo/profile-docbook.xsl
- XHTML - [oxygen_folder]/frameworks/docbook/xsl/xhtml/profile-docbook.xsl
- XHTML chunk - [oxygen_folder]/frameworks/docbook/xsl/xhtml/profile-chunk.xsl
- HTML - [oxygen_folder]/frameworks/docbook/xsl/html/profile-docbook.xsl
- HTML chunk - [oxygen_folder]/frameworks/docbook/xsl/html/profile-chunk.xsl

Having opened a DocBook 5 document go to Document -> Transformation -> Configure Transformation Scenario, Duplicate the scenario that you need and give it a proper name. Change the stylesheet to the appropriate one with profiling from the list above. You can simply browse for it using the Browse button.
e.g. for PDF change it from:

Press Parameters and in the shown list look for 'profile.condition', Edit it and give it the desired value. e.g. web
OK in all dialogs.

Now when you transform this scenario all the elements that have the 'condition' attribute set to 'web' will be kept, while the ones that have it set to other values will be excluded.

You can duplicate this scenario and set the 'profile.condition' parameter to various values thus transforming it with the specified profile.

Let me know if you need further assistance.