Topics

modifying multiple instances of a topic in the same map?


Chris Papademetrious
 

If I reuse the same topic in multiple bookmaps, and those bookmaps have a difference in profiling attributes (let's say, @product), then I can customize the topic for each bookmap:

<topic id="mytopic">
  <title>My Topic</title>
  <body>
    <p product="p1">This is customized for Product P1.</p>
    <p product="p2">This is customized for Product P2.</p>
  </body>
</topic>

But let's say I reuse a topic multiple times in the *same book*:

<bookmap>
  <chapter ...>
    <topicref href="mytopic.dita" keys="my1"/>
  </chapter>
  ...
  <chapter ...>
    <topicref href="mytopic.dita" keys="my2"/>
  </chapter>
</bookmap>

What mechanisms are available to customize each instance of that topic in the same book?

Is there a way to push a profiling attribute down into a referenced topic from the map?

 - Chris


Radu Coravu
 

Hi Chris,

If you want to have the same topic in multiple places of the DITA Map with slightly different content in each of those places you can use either key scopes or branch filtering:

https://oxygenxmlblog.netlify.com/presentation-reuse/reuse_keyscopes.html

https://oxygenxmlblog.netlify.com/presentation-reuse/reuse_branch.html

For example if you use key scopes inside the topic you can use conkeyref to refer to the paragraph and the conkeyref would be resolved to different paragraphs depending on the context.

Regards,
Radu

Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

On 2/7/2020 1:51 AM, Chris Papademetrious wrote:
If I reuse the same topic in multiple bookmaps, and those bookmaps have a difference in profiling attributes (let's say, @product), then I can customize the topic for each bookmap:
<topic id="mytopic">
  <title>My Topic</title>
  <body>
    <p product="p1">This is customized for Product P1.</p>
    <p product="p2">This is customized for Product P2.</p>
  </body>
</topic>
But let's say I reuse a topic multiple times in the **same book**:
<bookmap>
  <chapter ...>
    <topicref href="mytopic.dita" keys="my1"/>
  </chapter>
  ...
  <chapter ...>
    <topicref href="mytopic.dita" keys="my2"/>
  </chapter>
</bookmap>
What mechanisms are available to customize each instance of that topic in the same book?
Is there a way to push a profiling attribute *down into* a referenced topic from the map?
 - Chris


Ron Wheeler
 

You might want to explain your use case a bit in terms of what you want to customize and what you need to produce.

audience might be helpful.
It pushes the customization into the topic a bit.

In order to create bilingual documents, I have used audience to select the content in the topic that will be output.

    <shortdesc>
        <ph audience="en">This unit has 2 bedrooms and 1 bathroom in the interior of the building.</ph>
        <ph audience="fr">Cette unité dispose de 2 chambres et 1 salle de bain à l'intérieur du bâtiment.</ph>
    </shortdesc>

In my case this does the job very well and I like having the 2 languages in the same topic so that the text has a better chance of staying in synch.

If your case is more complex you may also have to think about using keyref/conkeyrefs as well.

Ron

On 2020-02-06 6:51 p.m., Chris Papademetrious wrote:
If I reuse the same topic in multiple bookmaps, and those bookmaps have a difference in profiling attributes (let's say, @product), then I can customize the topic for each bookmap:

<topic id="mytopic">
  <title>My Topic</title>
  <body>
    <p product="p1">This is customized for Product P1.</p>
    <p product="p2">This is customized for Product P2.</p>
  </body>
</topic>

But let's say I reuse a topic multiple times in the *same book*:

<bookmap>
  <chapter ...>
    <topicref href="mytopic.dita" keys="my1"/>
  </chapter>
  ...
  <chapter ...>
    <topicref href="mytopic.dita" keys="my2"/>
  </chapter>
</bookmap>

What mechanisms are available to customize each instance of that topic in the same book?

Is there a way to push a profiling attribute down into a referenced topic from the map?

 - Chris