How to tag for mutliple outputs

Oxygen general issues.
pwatt
Posts: 13
Joined: Thu Oct 01, 2009 9:53 pm

How to tag for mutliple outputs

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: How to tag for mutliple outputs

Post 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:

Code: Select all

<sect2 role="pdf"> ...  </sect2>
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
pwatt
Posts: 13
Joined: Thu Oct 01, 2009 9:53 pm

Re: How to tag for mutliple outputs

Post by pwatt »

So I was on the right track. And you got me further down it.

Thanks!
Tricia
pwatt
Posts: 13
Joined: Thu Oct 01, 2009 9:53 pm

Re: How to tag for mutliple outputs

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

Re: How to tag for mutliple outputs

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
pwatt
Posts: 13
Joined: Thu Oct 01, 2009 9:53 pm

Re: How to tag for mutliple outputs

Post 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
Post Reply