Page 1 of 1

How can I exclude unused keyrefs from HTML5 output?

Posted: Mon Jul 12, 2021 5:54 am
by akiraaa
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!

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

Posted: Mon Jul 12, 2021 3:10 pm
by sorin_carbunaru
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

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

Posted: Tue Jul 13, 2021 8:45 am
by akiraaa
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.

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

Posted: Tue Jul 13, 2021 10:21 am
by sorin_carbunaru
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

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

Posted: Tue Jul 13, 2021 11:01 am
by akiraaa
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!

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

Posted: Tue Jul 13, 2021 1:47 pm
by sorin_carbunaru
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.

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

Posted: Wed Jul 14, 2021 5:27 am
by akiraaa
Thanks!