How do I catch undefined keys?

38 views
Skip to first unread message

Fredrik Lönn

unread,
Jan 16, 2019, 7:44:53 AM1/16/19
to DITA-OT Users
Let's say that I have ditamap with a topic that contains an xref element that has a keyref using a key that is not defined.
Refer to the non-existing topic <xref keyref="someKey"/> for details.

The standard DITA-OT output will look like:
Refer to the nonexisting topic  for details.

In an extensive document this is not easily caught. Is there a way to either;

- Make the pdf generation fail with an error (preferred)
- Define a text string that is used instead of the missing reference

I am working with a dita-ot plugin based on the standard PDF2 plugin and I am using the FOP PDF formatter.

Best Regards,
Fredrik

Radu Coravu

unread,
Jan 16, 2019, 7:54:38 AM1/16/19
to Fredrik Lönn, DITA-OT Users
Hi Frederik,

As far as I know according to the DITA specification there is no error in referring an undefined key.
If you run the DITA OT output with verbose settings you should receive an information message like this in the console output:

   [keyref] ../introduction.dita:8:55: [DOTJ047I][INFO] Unable to find key definition for key reference "someKey" in root scope. The href attribute may be used as fallback if it exists

Maybe you can direct the console output to a file and then fail the script at the end of the file contains the error key "DOTJ047I".

Regards,
Radu

--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages