Select an image depending on the publication

Post here questions and problems related to editing and publishing DITA content.
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Select an image depending on the publication

Post by Le Basque »

Hi,

I want to Select an image depending on the publication.
For example :
For the web, I am displaying an image and PDF publishing another image.

How can I do?

Thank you for help
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: Select an image depending on the publication

Post by Radu »

Hi,

Probably either:

Probably you could insert for each image two <image> references something like:

Code: Select all

<image href="../../images/LilacPDF.jpg" audience="pdf"/>
<image href="../../images/LilacWEB.jpg" audience="html"/>
and apply the DITA OT processing with DITAVAL custom filtering which based on the profiling attribute value will remove one image reference or the other from the output depending on the publishing format.

Or to avoid duplicate image references in the DITA topic you could refer to the image with a keyref like:

Code: Select all

<image keyref="Lilac"/>
and in the DITA Map have references like this:

Code: Select all

  <topicref href="images/LilacPDF.jpg" format="jpg" keys="Lilac" audience="pdf"/>
<topicref href="images/LilacWEB.jpg" format="jpg" keys="Lilac" audience="html"/>
and again publish by filtering based on profiling conditions.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Re: Select an image depending on the publication

Post by Le Basque »

thank you for response,

For the first solution, you must change the file ditaval each publication?
In second solution i don't understand solution ? if image in topic i indcate the reference <image keyref="Lilac"/>

I can define link in ditamap ?
<topicref href="images/LilacPDF.jpg" format="jpg" keys="Lilac" audience="pdf"/>
if user selected xhtml DITA OT selects the correct link?

thank you
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: Select an image depending on the publication

Post by Radu »

Hi,
For the first solution, you must change the file ditaval each publication?
The transformation scenario for PDF would use a DITAVAL. The transformation scenario for XHTML would use another one.
In second solution i don't understand solution ? if image in topic i indcate the reference

Code: Select all


<image keyref="Lilac"/>
I can define link in ditamap ?

Code: Select all


<topicref href="images/LilacPDF.jpg" format="jpg" keys="Lilac" audience="pdf"/>
if user selected xhtml DITA OT selects the correct link?
The same in the first case, the transformation scenario for PDF would use a DITAVAL and the transformation scenario for XHTML would use another one. But in this case the DITA topic would not contain two image references, the DITA Map would contain two topic references to the images.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Re: Select an image depending on the publication

Post by Le Basque »

hi,

that contains the ditaval?

Best regards
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: Select an image depending on the publication

Post by Radu »

Hi,
that contains the ditaval?
When you edit a transformation scenario, in the Filters tab you can specify the path to a DITAVAL filter file.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Re: Select an image depending on the publication

Post by Le Basque »

Hi,

I created the file ditaval the ditamap with reference images, the DITA file calling an image by reference. I specified the location of ditaval in parameters.
Treatment works, but I get errors in the console
E[DITA-OT][DOTX021E]
Missing navtitle attribute or element for non-DITA resource "images/PDF.jpg". References must provide a local navigation title when the target is not a local DITA resource.................

Definition in ditamap :

Code: Select all

<topicref href="images/PDF.jpg" format="jpg" audience="pdf" keys="XXXX"/>
E[DITA-OT][DOTX025E]
Missing linktext and navtitle for non-DITA resource "images/PDF.jpg". References must provide a local navigation title when the target is not a local DITA resource.

An other question : Each treatment must be changed ditaval depending on the desired publication?

Thank you

Best regards
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: Select an image depending on the publication

Post by Radu »

Hi,
Missing linktext and navtitle for non-DITA resource "images/PDF.jpg". References must provide a local navigation title when the target is not a local DITA resource.
This warning is probably benign, it should have probably not been issued at all by the DITA Open Toolkit. To inhibit it you can add a navtitle attribute on the topicref:

Code: Select all

<topicref href="images/PDF.jpg" format="jpg" audience="pdf" keys="XXXX" navtitle="Image"/>
Each treatment must be changed ditaval depending on the desired publication?
Each transformation scenario must specify a DITAVAL which filters the references in the map accordingly based on the @audience attribute.

Ideally you would not need one image for PDF and another for the XHTML output, if your images appeared stretched-out in the PDF maybe you should read this:

http://www.oxygenxml.com/doc/ug-oxygen/ ... utput.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Re: Select an image depending on the publication

Post by Le Basque »

thank you Radu
Post Reply