Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOTJ047I] error for keys defined in local scopes #2523

Closed
ToshihikoMakita opened this issue Nov 18, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@ToshihikoMakita
Copy link
Contributor

commented Nov 18, 2016

DITA-OT 2.4 report this error for keys defined in local scopes. Here is sample bookmap authoring.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookmap PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd">
<bookmap xml:lang="en-US">
    <booktitle>
        <mainbooktitle>Online Help</mainbooktitle>
    </booktitle>
    <frontmatter>
        <mapref href="mKeyDef.ditamap"/>
    </frontmatter>
    <chapter href="topics/cUsingOnlineHelp.dita" navtitle="How to use online-help"/>
    <chapter navtitle="Prepareing to use the software" href="topics/cPreparingToUseSoftware.dita">
        <topicgroup keyscope="SINGLE-PRINTER">
            <keydef keys="REFERENCE-TOPIC" href="topics/tWhenConnectingASinglePrinter.dita"/>
            <keydef keys="CONNECTING_PRINTERS" href="collection-topics/tWhenConnectingPrintersTemplate.dita"/>
            <topicref navtitle="Connecting a single printer" keyref="REFERENCE-TOPIC" format="dita"/>
        </topicgroup>
        <topicgroup keyscope="MULTIPLE-PRINTER">
            <keydef keys="REFERENCE-TOPIC" href="topics/tWhenConnectingMultiplePrinters.dita"/>
            <keydef keys="CONNECTING_PRINTERS" href="collection-topics/tWhenConnectingPrintersTemplate.dita"/>
            <topicref navtitle="Connecting multiple printer"  keyref="REFERENCE-TOPIC" format="dita"/>
        </topicgroup>
    </chapter>
</bookmap>

The outputted error message:

[DOTJ045I] The key "REFERENCE-TOPIC" is defined more than once in the same map file. The reference href="topics/tWhenConnectingMultiplePrinters.dita" is ignored.
[DOTJ045I] The key "CONNECTING_PRINTERS" is defined more than once in the same map file. The reference href="collection-topics/tWhenConnectingPrintersTemplate.dita" is ignored.
[DOTJ047I] Unable to find key definition for key reference "REFERENCE-TOPIC" in root scope. The href attribute may be used as fallback if it exists
[DOTJ047I] Unable to find key definition for key reference "REFERENCE-TOPIC" in root scope. The href attribute may be used as fallback if it exists

Due to this error, tWhenConnectingASinglePrinter.dita and tWhenConnectingMultiplePrinters.dita are not outputted as HTML in XHTML transformation.

I attached sample data ZIP file.

diff-20161117.zip

@raducoravu

This comment has been minimized.

Copy link
Member

commented Nov 18, 2016

Tested and looks like a bug, I can also reproduce it with DITA OT 2.3.3.
A workaround for this particular case would be to avoid both declaring the keydef and using the key in the same scope like:

   .....
    <topicgroup keyscope="SINGLE-PRINTER">
        <keydef keys="CONNECTING_PRINTERS" href="collection-topics/tWhenConnectingPrintersTemplate.dita"/>
        <topicref navtitle="Connecting a single printer" keys="REFERENCE-TOPIC" href="topics/tWhenConnectingASinglePrinter.dita" format="dita"/>
    </topicgroup>
   .....
@ToshihikoMakita

This comment has been minimized.

Copy link
Contributor Author

commented Nov 18, 2016

Thank you for your investigation.

Your workaround removes last two error messages.
However I found serious xref error both in tWhenConnectingASinglePrinter.dita and tWhenConnectingMultiplePrinters.dita expanded result.

The both task contains <stepsection conkeyref="CONNECTING_PRINTERS/stepsection_01"/> and the target XML fragment is authored in tWhenConnectingPrintersTemplate.dita as follows:

<stepsection id="stepsection_01">To configure the settings of the color measurement instrument, go to step <xref keyref="REFERENCE-TOPIC/step-color" format="dita" type="step"/>. Otherwise, go to step <xref
    keyref="REFERENCE-TOPIC/step-other" format="dita" type="step"/>.</stepsection>

The key "REFERENCE-TOPIC" varies according to the key scope. But current DITA-OT seems to pay no attention for it.

As a result I got the following stepsection and xref result.

[tWhenConnectingASinglePrinter.html]

<p class="li stepsection">To configure the settings of the color measurement instrument, go to step 
<a class="xref" href="../collection-topics/../topics/tWhenConnectingMultiplePrinters.html#task_ops_1q4_wx__step-color">Connecting a single printer</a>. 
Otherwise, go to step <a class="xref" href="../collection-topics/../topics/tWhenConnectingMultiplePrinters.html#task_ops_1q4_wx__step-other">Connecting a single printer</a>.</p>

[tWhenConnectingMultiplePrinters.html]

<p class="li stepsection">To configure the settings of the color measurement instrument, go to step 
<a class="xref" href="../collection-topics/../topics/tWhenConnectingMultiplePrinters.html#task_ops_1q4_wx__step-color">Connecting a single printer</a>. 
Otherwise, go to step <a class="xref" href="../collection-topics/../topics/tWhenConnectingMultiplePrinters.html#task_ops_1q4_wx__step-other">Connecting a single printer</a>.</p>

The xref text and @href content is not valid.

I will submit another issue about this problem.

Regards,

@raducoravu

This comment has been minimized.

Copy link
Member

commented Jun 18, 2018

👍 Another one of our end users encountered this problem. Just tested this using DITA OT 3.1.
A simpler example:

        <!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
        <map>
            <title>keyscope test</title>
            <topicref keyscope="abc">
                <keydef keys="topic" href="topic.dita"/>
                <topicref keyref="topic"/>
            </topicref>
        </map>

published to XHTML when that keyref is encountered in the DITA Map shows the error:

      Unable to find key definition for key reference "topic" in root scope.

so keyrefs in the DITA Map do not seem to be resolved keyscope aware.

@infotexture

This comment has been minimized.

Copy link
Member

commented Feb 19, 2019

Resolved for 3.3 in #3194.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.