Page 1 of 1
How to tag for mutliple outputs
Posted: Mon Oct 05, 2009 8:12 pm
by pwatt
Hi
I'm using the DocBook editor--and am really new to DocBook. I want to use a single set of source files and output for multiple purposes: PDF, online help, website.
Which element (or which attribute of which element) should I use to indicate which elements should be included in each output? I'm guessing it would be the "condition" or "role" attribute.
Since most of the content needs to be included in most of the outputs, is there a way to specify that I want to exclude certain elements from a particular output--or is that done when I transform the document with some kind of "not" statement?
Once I've tagged the content correctly, how do I get the right content into the different outputs?
Thanks--really new to this.
Tricia
Re: How to tag for mutliple outputs
Posted: Tue Oct 06, 2009 10:21 am
by sorin_ristache
Hello,
A method for specifying the elements for a type of output is using the
profile attributes:
profile.audience or
profile.role or
profile.os, etc. You add the
profile attribute to the elements that you want to include in only one or more output types but not in all output types. For example if you want to include a
sect2 element only in PDF output you add the following attribute to that
sect2 element:
and when you apply the DocBook transformation you set the DocBook XSL parameter
profile.role to the value
'pdf' which will include in the output only the elements that have a
role attribute that includes the
'pdf' value and the elements with no role attribute. If the
role attribute has other values it will not be included in the output.
Regards,
Sorin
Re: How to tag for mutliple outputs
Posted: Tue Oct 06, 2009 4:21 pm
by pwatt
So I was on the right track. And you got me further down it.
Thanks!
Tricia
Re: How to tag for mutliple outputs
Posted: Tue Feb 09, 2010 6:53 pm
by pwatt
Hi,
It's been awhile since I asked this question. But I'm actually trying to do it now. And can't get it to work.
I want to use two roles: pdfOutput and htmlOutput. Mostly I want to output images in different sizes for the different outputs.
I have two transformation scenarios (one for PDF and one for HTML), and I define the profile.role parameter accordingly in each. I ran the scenarios a number of times, each time adding the role attribute to different elements in my DocBook source: imagedata, imageobject, mediaobject, figure, para. I assumed I need to have two almost identical elements with different roles and different scales--for example:
<imagedata fileref="images/assessment.jpg" align="center" scale="110" role="htmlOutput"/>
<imagedata fileref="images/assessment.jpg" align="center" scale="40" role="pdfOutput" />
But in the result I get 2 images, or a repeated paragraph (or whatever element I put in twice). So it seems like the role is not being picked up.
Thanks for any help.
Patricia
Re: How to tag for mutliple outputs
Posted: Wed Feb 10, 2010 4:18 pm
by adrian
Hi,
The first thing I would like to point out is that
role isn't the best choice for a profiling attribute. It can cause problems if you also use
emphasis with role(e.g.
<emphasis role="bold">) in your document. You can read more about it here:
http://www.sagehill.net/docbookxsl/Prof ... hRole.html
If you need a generic attribute with no preassigned semantics I would recommend
condition.
Now, regarding the transformation scenarios, for profiling you need to change the stylesheet(XSL URL) in the scenario:
- for HTML change it to ${frameworks}/docbook/xsl/html/profile-docbook.xsl
- for PDF change it to ${frameworks}/docbook/xsl/fo/profile-docbook.xsl
There usually is a corresponding
profile-docbook.xsl stylesheet in the same directory as the default stylesheet.
Let me know if you need further assistance.
Regards,
Adrian
Re: How to tag for mutliple outputs
Posted: Wed Feb 10, 2010 7:38 pm
by pwatt
Hi,
It worked finally, but some fiddling was required. Finally, this worked:
Code: Select all
<figure xml:id="figure-assessmentCentre" >
<title>Typical activities of the staff</title>
<mediaobject>
<imageobject condition="html">
<imagedata fileref="images/assessment.jpg" scale="110"/>
</imageobject>
<imageobject condition="pdf">
<imagedata fileref="images/assessment.jpg"scale="35"/>
</imageobject>
</mediaobject>
</figure>
I had to put the condition in <imageobject>, and I had to put the <imageobject> for html first; if not, I get two images in the html output. The PDF works better: doesn't matter whether I put its <imageobject> first or second, in both cases I just get one image.
Patricia