Using conkeyref-push to replace one topic with another at the map level


Chris Papademetrious
 

Hi folks!

According to the DITA spec at

https://docs.oasis-open.org/dita/dita/v1.3/os/part2-tech-content/archSpec/base/conref-overview.html

a conref/conkeyref can target:

  • A referenced element within a DITA map
  • A referenced element within a DITA topic
  • An entire DITA map
  • An entire DITA topic

We have a need to replace a boilerplate topic in a reused map with a product-specific topic. I created the following test map (topics 1-3 would actually be in the reused map):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="urn:oasis:names:tc:dita:rng:map.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<map>
    <title>Map</title>
    <topicref href="topic_2_replacement.dita" processing-role="resource-only"
        conkeyref="topic_2" conaction="pushreplace" />
    <topicref href="topic_1.dita" keys="topic_1"/>
    <topicref href="topic_2.dita" keys="topic_2"/>
    <topicref href="topic_3.dita" keys="topic_3"/>
</map>

but the DITA-OT issues the following error:

[conref-push] [DOTJ041E][ERROR] The attribute conref="topic_2.dita" uses invalid syntax. The value should contain '#' followed by a topic or map ID, optionally followed by '/elemID' for a sub-topic element.

It doesn't seem to want to operate on an entire topic. I was able to approximate the behavior by moving the pushes into the replacement topic <title> and <body> elements, but this is fragile and awkward.

Are entire-topic (and entire-map) operations not supported after all? Thanks in advance for any help!

 - Chris


Radu Coravu
 

Hi Chris,

This looks like a bug to me.

How about if you explicitly specify the topic ID when definining the "topic_2" key?

<topicref href="topic_2.dita#topicID" keys="topic_2"/>

Regards,

Radu

Radu Coravu
Oxygen XML Editor
On 2/25/21 19:16, Chris Papademetrious wrote:

Hi folks!

According to the DITA spec at

https://docs.oasis-open.org/dita/dita/v1.3/os/part2-tech-content/archSpec/base/conref-overview.html

a conref/conkeyref can target:

  • A referenced element within a DITA map
  • A referenced element within a DITA topic
  • An entire DITA map
  • An entire DITA topic

We have a need to replace a boilerplate topic in a reused map with a product-specific topic. I created the following test map (topics 1-3 would actually be in the reused map):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="urn:oasis:names:tc:dita:rng:map.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<map>
    <title>Map</title>
    <topicref href="topic_2_replacement.dita" processing-role="resource-only"
        conkeyref="topic_2" conaction="pushreplace" />
    <topicref href="topic_1.dita" keys="topic_1"/>
    <topicref href="topic_2.dita" keys="topic_2"/>
    <topicref href="topic_3.dita" keys="topic_3"/>
</map>

but the DITA-OT issues the following error:

[conref-push] [DOTJ041E][ERROR] The attribute conref="topic_2.dita" uses invalid syntax. The value should contain '#' followed by a topic or map ID, optionally followed by '/elemID' for a sub-topic element.

It doesn't seem to want to operate on an entire topic. I was able to approximate the behavior by moving the pushes into the replacement topic <title> and <body> elements, but this is fragile and awkward.

Are entire-topic (and entire-map) operations not supported after all? Thanks in advance for any help!

 - Chris

  


Julio J Vazquez
 

I think Radu's syntax is the most correct, but more correct would be to use and use key#topicid.

Julio J. Vazquez


Chris Papademetrious
 

Hi Julio, Radu,

Thanks for giving this some thought. This produced a different error:

[conref-push] [DOTJ043W][WARN] The conref push function is trying to replace an element that does not exist (element "#id3" in file "/tmp/temp20210226091132575/topic_3.dita").

so I filed a DITA-OT issue to reconcile the functionality against the spec:

Map-level conkeyref-push of a topic does not work #3711

Testcase provided with the issue, if you'd like to poke at it!

 - Chris