Dynamically change a chunk of content within a conref?

Post here questions and problems related to editing and publishing DITA content.
gchale3rd
Posts: 20
Joined: Wed Jan 04, 2017 3:48 pm

Dynamically change a chunk of content within a conref?

Post by gchale3rd »

I created a series of DITA task topics that explain how to create different configuration items in our portal. There are some steps that are the same for all types of configurations. I documented these reusable steps in a collection file and inserted them into the task topics using a conref.

There is one reusable step in which I would like to cite the configuration based on the topic in which the conref is used. Is it possible to dynamically change the configuration type cited in the conref based on the configuration type associated with the topic? Consider the following example steps that would be referenced in task topics for three different types of configurations: proxy, SAML, and container.
  • In the Comment field, enter the reason for creating the proxy.
  • In the Comment field, enter the reason for creating the SAML.
  • In the Comment field, enter the reason for creating the container.
The only solution I have come up with is to put the reusable step content minus the configuration type in a <ph> element. For example:

Code: Select all

<ph id="configuration_reason">In the <uicontrol>Comment</uicontrol> field, enter the reason for creating the</ph>
In each task topic, I would conref the <ph> element into the appropriate step and add the configuration type as static text after the conref. For example:

Code: Select all

<step>
    <cmd><ph conref="../_common/t_coll_config_tool.dita#t_coll_config_tool/configuration_reason"/> proxy.</cmd>
</step>
I appreciate your thoughts.

I am using Oxygen XML Editor 25.1.
Radu
Posts: 8956
Joined: Fri Jul 09, 2004 5:18 pm

Re: Dynamically change a chunk of content within a conref?

Post by Radu »

Hi,
I think what you want would be possible if you used DITA key scopes with key refs and content key references.
The DITA Map would look like this:

Code: Select all

<topicref href="myTask.dita" keyscope="ks">
    <keydef keys="variableSuffix">
      <topicmeta>
        <keywords>
          <keyword>prefix</keyword>
        </keywords>
      </topicmeta>
    </keydef>
    <keydef keys="reusableSteps" href="reusableSteps.dita"/>
  </topicref>
with "reusableSteps.dita" looking like:

Code: Select all

<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="reusableSteps">
    <title></title>
    <taskbody>
        <steps>
            <step id="reused">
                <cmd>some content here <ph keyref="variableSuffix"/></cmd>
            </step>
        </steps>
    </taskbody>
</task>
and the "myTask.dita" containing a

Code: Select all

<step conkeyref="reusableSteps/reused"/>
But this might in a way complicate things also make things more difficult for translations as it's best to translate entire block elements and not to translate individual texts which end up being concatenated together.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gchale3rd
Posts: 20
Joined: Wed Jan 04, 2017 3:48 pm

Re: Dynamically change a chunk of content within a conref?

Post by gchale3rd »

Thank you Radu. I will experiment with your suggestion.
gchale3rd
Posts: 20
Joined: Wed Jan 04, 2017 3:48 pm

Re: Dynamically change a chunk of content within a conref?

Post by gchale3rd »

I tried using the key scope you suggested. Instead of each topic displaying the keyword defined in its corresponding <topicref> element, all of the topics display the key word that was defined in the first <topicref> element.

Here is the example you provided for the map. I expanded this example by adding two additional <topicref> elements.

Code: Select all

<topicref href="myTask1.dita" keyscope="ks">
    <keydef keys="variableSuffix">
      <topicmeta>
        <keywords>
          <keyword>prefix1</keyword>
        </keywords>
      </topicmeta>
    </keydef>
    <keydef keys="reusableSteps" href="reusableSteps.dita"/>
  </topicref>
<topicref href="myTask2.dita" keyscope="ks">
    <keydef keys="variableSuffix">
      <topicmeta>
        <keywords>
          <keyword>prefix2</keyword>
        </keywords>
      </topicmeta>
    </keydef>
    <keydef keys="reusableSteps" href="reusableSteps.dita"/>
  </topicref>
<topicref href="myTask3.dita" keyscope="ks">
    <keydef keys="variableSuffix">
      <topicmeta>
        <keywords>
          <keyword>prefix3</keyword>
        </keywords>
      </topicmeta>
    </keydef>
    <keydef keys="reusableSteps" href="reusableSteps.dita"/>
  </topicref>
When I run the transformation scenario, the conkeyrefs in all three topics use the keyword prefix1, which is the keyword defined in the <topicref> element for the first topic. I was hoping to see prefix2 used in the conkeyref in topic2 and prefix3 used in the conkeyref in topic3.

I used the same @keyscope value in all three <topicref> elements. I also used the same @keys value in the <keydef> element containing the keyword.

Let me know if you have any thoughs.
Radu
Posts: 8956
Joined: Fri Jul 09, 2004 5:18 pm

Re: Dynamically change a chunk of content within a conref?

Post by Radu »

Hi,
I used the same @keyscope value in all three <topicref> elements.
You should try to use a different key scope value for each of these topicrefs, something like ks1, ks2, ks3. Otherwise the behavior will be as if all three are from the same key scope "ks" and the conkeyref will resolve to a single target in a key scope context.
If that does not work, maybe you can zip a small example and send it to us (support@oxygenxml.com) and I can try to take a look at it.
https://www.oxygenxml.com/dita/1.3/spec ... copes.html
Key references in each key scope are resolved using the effective key definition that is specified within its own key scope.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gchale3rd
Posts: 20
Joined: Wed Jan 04, 2017 3:48 pm

Re: Dynamically change a chunk of content within a conref?

Post by gchale3rd »

Using a unique @keyscope attribute value for each <topicref> element resolved the issue. I expanded by test by defining a second keyword (in a second <keydef> element within each key scope. That enabled be to substitute a second keyword in a different conkeyref within each topic. Thank you for your help Radu.
Radu
Posts: 8956
Joined: Fri Jul 09, 2004 5:18 pm

Re: Dynamically change a chunk of content within a conref?

Post by Radu »

Hi,
I'm glad this works for you!
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply