How can I exclude unused keyrefs from HTML5 output?

akiraaa
Posts: 8
Joined: Mon Dec 14, 2020 11:20 am

How can I exclude unused keyrefs from HTML5 output?

Post by akiraaa » Mon Jul 12, 2021 5:54 am

Hi,

Suppose I have two keys defined for topic1 and topic2 in test_key.ditamap:

Code: Select all

    <keydef keys="key1" href="topic1.dita">
        <topicmeta>
            <keywords>
                <keyword>topic1</keyword>
            </keywords>
        </topicmeta>
    </keydef>
    <keydef keys="key2" href="topic2.dita">
        <topicmeta>
            <keywords>
                <keyword>topic2</keyword>
            </keywords>
        </topicmeta>
    </keydef>
In the root DITA map I only use the keyref for topic1:

Code: Select all

<map>
    <title>Test output of keys</title>
    <topicref href="test_key.ditamap" format="ditamap"/>
    <topicref keyref="key1"/>
</map>
When I output the DITA map to HTML5, the index page only includes topic1, but topic2 is also output as an html5 file.

I tried PDF output, it only included topic1, so I'm wondering if it's possible to output HTML5 files that only includes the keyrefs used in the DITA map.

Thanks!

sorin_carbunaru
Posts: 384
Joined: Mon May 09, 2016 9:37 am

Re: How can I exclude unused keyrefs from HTML5 output?

Post by sorin_carbunaru » Mon Jul 12, 2021 3:10 pm

Hello,

I tried you scenario in <oXygen/> XML Editor 23.1, build 2021061407, and I didn't reproduce the problem. I actually published to a few HTML-related formats (HTML5, XHTML, WebHelp Responsive), and for all of them there was only one topic file generated. I used the built-in DITA-OT 3.x for publishing.

What version of Oxygen are you using? Do you use a custom DITA-OT? You can check the DITA preferences page to check what DITA-OT you use.

Best wishes,
Sorin Carbunaru
Oxygen XML Editor

akiraaa
Posts: 8
Joined: Mon Dec 14, 2020 11:20 am

Re: How can I exclude unused keyrefs from HTML5 output?

Post by akiraaa » Tue Jul 13, 2021 8:45 am

Hi,

I'm using <oXygen/> XML Author 23.1, build 2021030206 and the built-in DITA-OT 3.x, and the built-in DITA HTML5 transformation scenario.

I just found that in topic2, I used keyref of key2 in the title and indexterm:

Code: Select all

    <title><ph keyref="key2"/></title>
    <shortdesc id="short"><ph id="shortdesc">Join the channel and set whether to automatically subscribe to audio or video streams.</ph></shortdesc>
    <prolog>
        <metadata>
   <keywords>
       <indexterm keyref="key2" />
   </keywords>
        </metadata>
    </prolog>
If I removed the keyrefs of key2 in topic2, then the output would be as expected. But I can't understand why, as topic2 was not included in the DITA map at all.

I also tried the XHTML and WebHelp Responsive formats, all had the same issue.

sorin_carbunaru
Posts: 384
Joined: Mon May 09, 2016 9:37 am

Re: How can I exclude unused keyrefs from HTML5 output?

Post by sorin_carbunaru » Tue Jul 13, 2021 10:21 am

Hello,

If you have that key reference, it's normal for the corresponding file to be in the output folder, in order for the reference to be properly resolved. Otherwise you would have a broken reference. It wasn't included in the index.html file because there was no reference to it in the map. The index file reflects the the map.

Regards,
Sorin

akiraaa
Posts: 8
Joined: Mon Dec 14, 2020 11:20 am

Re: How can I exclude unused keyrefs from HTML5 output?

Post by akiraaa » Tue Jul 13, 2021 11:01 am

Hi,

Thanks for the reply. But the key reference was only inside topic2 which was not in the DITA map. The DITA map only includes topic1 which has no reference to key2. I'm wondering if there are possible configurations to exclude this file.

Thanks!

sorin_carbunaru
Posts: 384
Joined: Mon May 09, 2016 9:37 am

Re: How can I exclude unused keyrefs from HTML5 output?

Post by sorin_carbunaru » Tue Jul 13, 2021 1:47 pm

I didn't find any argument that helped. On the other hand, I found this DITA-OT issue: https://github.com/dita-ot/dita-ot/issues/3692. It seems a bit similar to your situation. Perhaps they have a common cause.

You could add your situation on that issue. Maybe this will increase its priority.

akiraaa
Posts: 8
Joined: Mon Dec 14, 2020 11:20 am

Re: How can I exclude unused keyrefs from HTML5 output?

Post by akiraaa » Wed Jul 14, 2021 5:27 am

Thanks!

Post Reply