Exclude text from output

Here should go questions about transforming XML with XSLT and FOP.
burbles
Posts: 37
Joined: Wed Dec 23, 2009 6:13 am

Exclude text from output

Post 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?
Thanks
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Exclude text from output

Post by adrian »

Hello,

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:
${frameworks}/docbook/xsl/fo/docbook_custom.xsl
to
${frameworks}/docbook/xsl/fo/profile-docbook.xsl

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.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply