Cross-reference to the same topic used in TWO DITAMAPs

Post here questions and problems related to editing and publishing DITA content.
girishkanmas
Posts: 8
Joined: Thu Apr 14, 2022 8:37 am

Cross-reference to the same topic used in TWO DITAMAPs

Post by girishkanmas »

OUTPUT FORMAT: XSL-FO PDF
I have reused a topic in two different DIATAMAPs in a document.
I would like to add two cross-references to the reused topic so that the respective link navigates to the intended section of the DITAMAP in the PDF.
Any help?
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by julien_lacour »

Hello,

Are you publishing these ditamap separately or are they referenced in a parent one?
Could you give us more details or even a small sample showing the problem (only with the structure, the content can be random)?

Regards,
Julien
girishkanmas
Posts: 8
Joined: Thu Apr 14, 2022 8:37 am

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by girishkanmas »

I am using both the DITAMAPs in the same BookMap.
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by julien_lacour »

Hello,

A solution could be to duplicate the topic and in the duplicated topic refer the content from the original topic. Each topic will be referenced in its ditamap.
Then one link will lead to the original topic while the other will lead to the duplicated one. I added a sample to make it clearer.
conref.zip
(1.85 KiB) Downloaded 47 times
Regards,
Julien
girishkanmas
Posts: 8
Joined: Thu Apr 14, 2022 8:37 am

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by girishkanmas »

Thank you for your solution, Julien.
Last edited by girishkanmas on Mon Jul 31, 2023 11:47 am, edited 1 time in total.
girishkanmas
Posts: 8
Joined: Thu Apr 14, 2022 8:37 am

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by girishkanmas »

Is there way we can specify the DITAMAP context in the <xref> tag for a topic reused in the same BookMap?
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by julien_lacour »

Hello,

There is a possibility using @keyscope attribute on the ditamaps references in the bookmap, then using @keyref in <xref> elements.
The problem is that, to make this solution works, the topics must have a slightly different content (for example a key with the product name - the structure is the same but the displayed text differs). If not the links will lead to the first target (as they are just references to the same topic).

Regards,
Julien
girishkanmas
Posts: 8
Joined: Thu Apr 14, 2022 8:37 am

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by girishkanmas »

Hi Julien,

I agree with you. When using DITAMAP level keyscope, TopicRef-level keys, and then Xref with keyref (scope_name.key_name), it still directs to the first instance of the topic. Therefore, I followed your first suggestion and created a new topic using Conref.

Thank you for your help.

Best regards,
Girish
Last edited by girishkanmas on Tue Aug 08, 2023 9:18 am, edited 1 time in total.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Cross-reference to the same topic used in TWO DITAMAPs

Post by chrispitude »

Hi Girish,

The keyscoped topics should have become unique if there was some kind of key reference in the topic. Here is a testcase that demonstrates the duplication:

oxygen_two_topic_instances.zip
(5.55 KiB) Downloaded 34 times

Here is more information about what causes the DITA-OT to uniquify topics:

#4173: Why does a transformation sometimes create duplicate topic files?

- Chris
Post Reply