Page 1 of 1

Reuse content action automatically inserts a <ph/> element

Posted: Wed Jul 24, 2024 11:20 am
by ckabstein
Hi,
In Oxygen 25.1, we have come across the following issue while editing DITA topics:
The "Reuse content" action automatically inserts a <ph/> element when conrefing plentry elements.
In the following example, you can see where the <ph/> element is added. In the previous Oxygen XML version 25.0, this didn't happen. Only the <pt/> and </pd> elements were added (see second <plentry> element):

Code: Select all

<refbody>
    <section id="section_tmf_txx_m1c">
      <fig>
        <image href="../../../_shared_picts/my_picture.png">
          <alt/>
        </image>
      </fig>
      <parml>
        <plentry conref="../_shared/my_xml_file_r.xml#my_xml_file_r/my_parameter">
          --> <pt><ph/></pt> <--
          <pd/>
        </plentry>
        <plentry conref="../_shared/my_xml_file_r.xml#my_xml_file_r/my_parameter">
          <pt/>
          <pd/>
        </plentry>
We didn't make any changes to that action. We only noticed it because the <ph/> element suddenly appeared as to be translatable in our translation tool. Do you have any idea why the <ph/> element is added?
I haven't checked the latest Oxygen version yet, because we haven't had the time to update.

Thanks,
Christina

Re: Reuse content action automatically inserts a <ph/> element

Posted: Thu Jul 25, 2024 7:12 am
by Radu
Hi Christina,
I could not reproduce this problem using the "Reuse content" action on my side:

Code: Select all

<topic id="introduction">
    <title>Introduction</title>
    <body>
        <p>hello<parml id="parml_mwz_hyc_2cc">
                <plentry id="abc">
                    <pt>hello</pt>
                    <pd>hello2</pd>
                </plentry>
            </parml></p>
        <p>
            <parml>
                <plentry conref="#./abc">
                    <pt/>
                    <pd/>
                </plentry>
            </parml>
        </p>
    </body> 
</topic>
The problem is benign, the actual content of the <plentry> which has a conref does not matter, it just needs to be valid.
Oxygen in general attempts to make the element which has the conref valid, meaning that for example it inserts inside the <plentry> the <pt> and <pd> elements as they are required.
I do not quite know why it also inserts the <ph> inside the <pt> on your side, maybe some framework specific configuration in the cc_config.xml file stating that the <pt> should always have a <ph> inside?
Looking in our internal issues list indeed we had an issue in Oxygen 25.1 to better generate required choice elements on the element which has the conref, based on the associated schema.
Are you also using a DITA DTD specialization?
In order to sort this out I might need to have a full sample on my side with a small DITA topic, the specialization DTD plugins, maybe even the framework configuration.

Regards,
Radu

Re: Reuse content action automatically inserts a <ph/> element

Posted: Thu Jul 25, 2024 10:49 am
by ckabstein
Hi Radu,
After investigating a little bit more, I've found that there is now some kind of built-in functionality that automatically inserts the first element that appears in the <choice> list in pt.content. So, for example, I've changed the <choice>-list in our RNG schema to reference "filepath" as the first element in the list instead of "ph.element". Now <filepath> is automatically inserted in the <pt> element.
Our custom programming domain RNG:

Code: Select all

<define name="pt.content">
          <zeroOrMore>
            <choice>              
              <ref name="filepath"/>
              <ref name="ph.element"/>
              ...
Oxygen Author mode:

Code: Select all

<parml>
        <plentry conref="../_shared/my_xml_file_r.xml#my_xml_file_r/my_parameter">
          <pt><filepath/></pt>
          <pd/>
        </plentry>
As I've used exactly the same framework in 25.0 and 25.1 and didn't make any new changes in the cc-config, I'm not sure if this is really a framework-related problem. As you can see in our RNG, the <choice> elements are not required. So I wonder why one of those elements is used.
Please let me know if you still require samples and respective framework files.

Thanks,
Christina

Re: Reuse content action automatically inserts a <ph/> element

Posted: Thu Jul 25, 2024 11:57 am
by Radu
Hi Christina,
Thanks for the extra details, especially about that choice used inside the RNG schema, I do not think I need more samples for now.
Indeed this looks like a side effect of an issue we fixed in Oxygen 25.1 related to schema choices and Oxygen's strive to create valid XML elements with all their required elements when inserting conrefs. But indeed when the choice is zero or more, Oxygen should not follow the choice and generate the first element inside it.
I added an internal issue on our side to look more into this, pasting the internal issue ID below for future reference:
EXM-54709 Descendants of inserted element with conref has non required child elements
In the meantime you can probably ignore the issue, the publishing should not take the extra content generated inside the element which contains the conref into account anyway.
Regards,
Radu

Re: Reuse content action automatically inserts a <ph/> element

Posted: Thu Jul 25, 2024 5:06 pm
by ckabstein
Hi Radu,
You're right. For publishing, ignoring the issue is not a problem. For localization, though, it is, because that element turns up in its own segment. :-)
I will create a Schematron rule for this, so that authors can validate their docs to take out the element. I've already had a rule for empty <ph> elements, but it didn't apply to conrefed <plentry> elements.
Thanks!
Christina