Page 1 of 1

Display ditaval flag on topicref and mapref

Posted: Wed Sep 01, 2021 6:08 pm
by matt_k
Hi there

I have created a ditaval to display different background and text colours for specified product and platform values, on publication. These work as expected when applied to elements within a topic.

However, we have some topics and maps referenced in our bookmaps, that may have platform or product attributes applied. The ditaval flags do not appear to work on topicref or mapref elements. Is that expected behaviour? Or, is there a way that it can be achieved.

Many thanks

Matt

Re: Display ditaval flag on topicref and mapref

Posted: Thu Sep 02, 2021 6:24 am
by Radu
Hi Matt,

Is this question related to editing or to publishing? If it's about publishing, to what output format do you publish?
Can you maybe give a small example about how the DITA Map looks like, what the DITAVAL looks like and what the expected publishing should look like?

Regards,
Radu

Re: Display ditaval flag on topicref and mapref

Posted: Thu Sep 02, 2021 5:25 pm
by matt_k
Hi Radu

This question relates to publishing to PDF and EPUB.

I've replicated what we are trying to achieve below:

The map:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="ditamap-8452" xml:lang="en-gb" class="- map/map ">
    <title class="- topic/title ">Test map</title>
    <topicref href="topic_1.dita" class="- map/topicref ">
        <topicref product="pl1" href="pl1_topic.dita" class="- map/topicref "/>
        <topicref product="pl2" href="pl2_topic.dita" class="- map/topicref "/>
        <topicref product="pl3" href="pl3_topic.dita" class="- map/topicref "/>
        <topicref product="pl4" href="pl4_topic.dita" class="- map/topicref "/>
    </topicref>
</map>
topic_1.dita looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic-5562" xml:lang="en-gb" class="- topic/topic "><title class="- topic/title ">Topic 1</title><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "><author translate="no" type="creator" class="- topic/author ">Matt</author><metadata class="- topic/metadata "><keywords class="- topic/keywords "/></metadata></prolog><body class="- topic/body "><p class="- topic/p ">This topic has some content for each of the 4 outputs:</p><ul class="- topic/ul "><li product="pl1" class="- topic/li ">
                <p class="- topic/p ">This bullet is for PL1.</p>
            </li><li product="pl2" class="- topic/li ">
                <p class="- topic/p ">This bullet is for PL2.</p>
            </li><li product="pl3" class="- topic/li ">
                <p class="- topic/p ">This bullet is for PL3.</p>
            </li><li product="pl4" class="- topic/li ">
                <p class="- topic/p ">This bullet is for PL4.</p>
            </li></ul></body></topic>
pl1_topic.dita looks like this (others are the same, but with different pl#):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic-6268" xml:lang="en-gb" class="- topic/topic ">
    <title class="- topic/title ">PL1 topic</title>
    <shortdesc class="- topic/shortdesc "/>
    <prolog class="- topic/prolog ">
        <author translate="no" type="creator" class="- topic/author ">Matt</author>
        <metadata class="- topic/metadata ">
            <keywords class="- topic/keywords "/>
        </metadata>
    </prolog>
    <body class="- topic/body " product="pl1">
        <p class="- topic/p ">This topic is for PL1 only.</p>
    </body>
</topic>
The ditaval that we want to use to show all content, but with a different colour for each product attribute, looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<val>
    <prop action="exclude" att="audience">
        <startflag/>
    </prop>
    <prop action="include" att="audience" val="pdf"/>
    <prop action="exclude" att="platform" val="subjective"/>
    <prop action="flag" att="product" color="#00B0F0" val="pl1"/>
    <prop action="flag" att="product" color="red" val="pl2"/>
    <prop action="flag" att="product" color="green" val="pl3"/>
    <prop action="flag" att="product" color="magenta" val="pl4"/>
</val>
Where we have applied a product attribute to a topicref, we would like to include it in the output, but with the colour defined in the ditaval.

As an alternative, I tried applying the product attribute to the <body> element, but that doesn't appear to work.

I'd be grateful for any suggestions that you may have.

I'll email a package of the content and output to the support email address.

Many thanks

Regards

Matt

Re: Display ditaval flag on topicref and mapref

Posted: Thu Sep 02, 2021 7:05 pm
by matt_k
I've done a bit more testing.

I have found that we can achieve the required results by applying the product attribute to a child element of the topic body, even if the topicref has the same product attribute.

I tested this by adding a Learning Content topic to the same map, applied the product attribute to the topicref and to the learningContentbody/lcIntro, like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE learningContent PUBLIC "-//OASIS//DTD DITA Learning Content//EN" "learningContent.dtd">
<learningContent id="untitled1">
    <title>PL 1 learning topic</title>
    <learningContentbody>
        <lcIntro id="lcIntro_kym_ldq_5qb" product="pl1">
            <p>This is a PL1 learning topic.</p>
        </lcIntro>
    </learningContentbody>
</learningContent>
It is not very elegant or ideal, but it seems to work.

Re: Display ditaval flag on topicref and mapref

Posted: Fri Sep 03, 2021 9:10 am
by Radu
Hi Matt,

I found this older issue I had added on the DITA Open Toolkit issues list, re-opened it and added a reference to this forum thread:
https://github.com/dita-ot/dita-ot/issues/2809

Indeed right now as a workaround you need to add the profiling attribute also inside the topic, from my small tests adding it to the root element should also work.

Regards,
Radu

Re: Display ditaval flag on topicref and mapref

Posted: Fri Sep 03, 2021 1:13 pm
by matt_k
Thanks Radu

We'll add the profiling attribute to the topic root element for now.

Re: Display ditaval flag on topicref and mapref

Posted: Tue Oct 19, 2021 3:13 pm
by julien_lacour
Hello,

Starting with Oxygen 24.0, flagging attributes (@audience, @platform, @product, etc.) set on topicrefs are copied onto their target topics when using DITA Map PDF - based on HTML5 & CSS transformation.

Regards,
Julien

Re: Display ditaval flag on topicref and mapref

Posted: Fri Oct 22, 2021 5:00 pm
by matt_k
Thanks Julien