Translate ONLY translate="yes" segments in DITA files

Hello,

I would like to translate ONLY segments with a translate="yes" attibute in my DITA files. Other segments do not have a translate="no" attribute as the client only mentioned what they need to translate.

Is there a way to filter/lock/exclude the segments that have no attribute and keep only the ones with translate="yes"?

For example

<note type="warning" id="note_ity_xsj_5bc" translate="yes">CONTENT TO BE TRANSLATED.</note>
<p>CONTENT NOT TO BE TRANSLATED <xref keyref="ONAPurgeflush"/>.</p>
<p>CONTENT NOT TO BE TRANSLATED:</p>
<ul id="ul_ubh_bxb_lsb">
<li>CONTENT NOT TO BE TRANSLATED.</li>

Thanks a lot for your help.

emoji
Parents Reply
  • Hello , we've been facing another issue with the filter. This time, our client placed the "translate = yes" at the level of topic. However, even though we placed //topic below or above "translate = yes", it did not identify what needed to be translated. The file counted 0 words.

    Table displaying translation rules for XML elements, with columns for rule, translation, and tag type. Some rows include 'translate=yes' and nested translation rules.

    Here is the example of file:

    XML file example with 'translate=yes' attribute at the topic level. Includes a title and body with nested elements, such as paragraphs and lists, in French.

    We are trying to work like this as some of the client's file do not have "translate = yes" attributes and need to be translated integrally but we do not want to create two different Studio project (at the moment we create one project for the files without any attribute, and one project with the filter. If we place the files without the attributes, they do not show any words due to filter.

    Please let me know if you need more details and more examples.

    Thanks in advance for your help.

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 1:48 PM (GMT 1) on 4 Sep 2025]
Children
  •  

    In this file the translatable content doesn't have the translate attribute in the element itself whereas before it did.  So that is why your old file won't pick up any of this content... assuming this is what you mean should be translated by virtue of the parent element having the translate = yes attribute?

    I imagine you have files with multiple topics so the root must be <dita> or something like that rather than <topic>?  If that's not the case then all you need to do by the looks of it is remove the //*[translate='yes'] rule altogether since its omission surely means you either don't translate at all, or you translate everything?

    But if you do have multiple topics... like this for example:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE dita PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
    <dita>
    
      <topic id="intro">
        <title>Introduction</title>
        <body>
          <p>
            <div>
              <p>This is an introductory section, not marked for translation.</p>
              <ul>
                <li><p>Background information for readers.</p></li>
                <li><p>General context only.</p></li>
              </ul>
            </div>
          </p>
        </body>
      </topic>
    
      <topic id="niveau_de_cybersécurité_de___" translate="yes">
        <title>Niveau de cybersécurité de <ph keyref="product"/></title>
        <body>
          <p>
            <div>
              <p dir="ltr">Les informations qui sont indiquées dans ce chapitre sont destinées au personnel responsable de l’installation et de la maintenance des dispositifs médicaux. Il doit être compris dans sa totalité.</p>
              <p dir="ltr">Le dispositif <ph keyref="product"/> intègre des fonctions de sécurité de niveau SL-C 2 lui permettant d’assurer sa fonction de vigilance des réseaux de gaz même si le réseau de communication du système d’information de l’hôpital est corrompu.</p>
              <ul id="ul_zcg_3zk_bgc">
                <li dir="ltr"><p dir="ltr">Enregistrements horodatés des événements et accessibilité directe par les utilisateurs</p></li>
                <li dir="ltr"><p dir="ltr">Accès physique restreint contre les codes malveillants</p></li>
                <li dir="ltr"><p dir="ltr">Vérification de l’intégrité du logiciel en production</p></li>
                <li dir="ltr"><p dir="ltr">Protection contre le déni de service</p></li>
                <li dir="ltr"><p dir="ltr">Récupération et reconstitution du système en cas de défaut.</p></li>
              </ul>
            </div>
          </p>
        </body>
      </topic>
    
      <topic id="appendix">
        <title>Appendix</title>
        <body>
          <p>
            <div>
              <p>This appendix provides supplementary details, not for translation.</p>
              <ul>
                <li><p>Additional notes.</p></li>
                <li><p>Reference entries.</p></li>
              </ul>
            </div>
          </p>
        </body>
      </topic>
    
    </dita>
    

    Then you could use something like this for example:

    //topic[not(@translate="yes")]

    Basic idea being to ignore any topics completely unless they have translate="yes".  So you change the rules you have to be this and make it not translatable.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • Thank you very much for your anwser.
    Here are my defined roots (we have multiple files for every project):

    A table with two columns labeled 'Type' and 'R gle', showing rows with values like concept, reference, task, topic, faq, dita, map, and subjectScheme.

    The root element in this file is topic. We do not have multiple topics.

    Usually, we need to translate only the translate = yes. The client adds its tag for every attribute. Here the client wanted to translate the whole file without having to add the attribute. Therefore, he put translate = yes in the topic tag to apply it to the entire file. This method would have helped us create a single project as we usually have to create two different projects: one where the dita files have to be translated in their entirety (they do not carry translate = yes attributes and we do not apply our filter, we use the Studio default filter), and one project for files with translate = yes.

    We did not find a way to include all the files in a single project yet.

    I have tried your solution but even though I place the //topic[not(@translate="yes")] above or below the //*[translate='yes'], it does not include this file.

    Please let me know if you need more elements to understand the situation.Duplicate of the first image showing a table with columns 'Type' and 'R gle', listing values such as concept, reference, task, topic, faq, dita, map, and subjectScheme.

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 3:58 PM (GMT 1) on 8 Sep 2025]
  •  

    Maybe you could use something like this?

    //topic[not(@translate="yes")]//topic[not(ancestor::topic[@translate="yes"])]

    So, only exclude nested topics that don't have translate="yes" AND whose ancestors don't have it either.  Untested... but perhaps it helps?

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji