question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A <mapref> with a @keys attribute is processed incorrectly

See original GitHub issue

Expected Behavior

If <mapref> elements have the @keys attribute defined:

3815_1

then publishing should yield the same results as if @keys was not defined.

Actual Behavior

The content is published incorrectly in the preprocess2 pipeline, as described below. (preprocess is also affected when force-unique is used - see comments below this description.)

During the mapref preprocessing stage, the presence of the @keys attribute causes a <keydef> element to be created in addition to a <submap> element for the referenced map contents:

3815_2

During the branch-filter preprocessing stage, the profiled “Product” key values are correctly pruned to reflect the <ditavalref>:

3815_3

During the keyref preprocessing stage, the <keydef> element is incorrectly processed to insert a redundant (and unfiltered) <submap> of “Product” values:

3815_4

When preprocess2 is used, because topics are processed after maps, the unfiltered “Product” key values are incorrectly used to resolve the key reference in the topic file, causing the ***ERROR*** value to be used in the output.

(Note that an extra preprocessing-only topic reference to preface.dita is also created, but it does not affect output in this testcase.)

Possible Solution

Somehow the second insertion of the <submap> (due to the <keydef>) must be prevented. I don’t know enough about the keyref stage to know what element structures should/should not be created.

Steps to Reproduce

  1. Unarchive the following testcase: ditaot_mapref_keys_bug.zip
  2. Run the pdf2 transformation: dita -i map.ditamap -f pdf2

Environment

  • DITA-OT version: 3.7
  • Operating system and version: Ubuntu 20.04
  • How did you run DITA-OT? dita command
  • Transformation types: pdf2

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
chrispy-snpscommented, Sep 20, 2022

@SoonBoonChin - thank you for sharing your findings! I am always hesitant to change the default ordering of preprocessing steps for our production processing, but I think it’s good information that the cause of the bug is some kind of order dependency.

@raducoravu - interesting! I took a closer look. In the map-keyref figure in the issue description, the questionable submap copy of preface.ditamap (shown in red) has processing-role="resource-only", which causes the duplicate topics. The fix suppresses these duplicates, which is a nice practical benefit until the @keys processing itself can be fixed.

I also confirmed that even with the #3815/#4003 fix, the preprocess2 bug for incorrect key resolution still occurs, as it is an independent bug caused by the duplicate <submap>.

0reactions
raducoravucommented, Oct 5, 2022

@SoonBoonChin you can open a pull request yourself, anybody can open pull requests, you do not need to be a project admin for this: https://www.dita-ot.org/contributing#coding

We are not using the “preprocess2” stage by default with the PDF (CSS based on XSL-FO based) and WebHelp outputs generated from the DITA OT bundled with Oxygen. And the “preprocess” stage no longer has this problem after the fix I made here: https://github.com/dita-ot/dita-ot/pull/4003 So I’m not directly interested in further investigating a possible fix for this.

Also I believe the possible fix where you do keyref processing before branch filtering has the potential to generate side effects, even if all the auto tests will work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding DITA Keys and Key Spaces - OASIS Open
This attribute, new in DITA 1.2, indicates whether the topicref contributes to the main navigation tree of the map (the value "normal", which...
Read more >
DITA-OT error messages
Message ID Severity Message text DOTA013F Fatal Cannot find the specified DITAVAL ' %1 '. DOTJ012F Fatal Failed to parse the input file ' %1...
Read more >
Scoped Keys in DITA 1.3 (Finally!) - IXIASOFT
ditamap” keyscope=“gadget”/> </map> The first thing you notice is the attribute keyscope on both maprefs. This attribute is new in DITA 1.3 and...
Read more >
mapref - Oxygen XML Editor
The mapref element is a convenience element that is equivalent to a topicref element with the format attribute set to "ditamap".
Read more >
DITA: Folder hierarchy, conref, mapref, and more
DITA: Folder hierarchy, conref, mapref, and more ... You include an attribute called processing-role="resource-only" to include the topic ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found