XPath expressions in Multilingual XML extracts only the first match

Hello,

To insert terms for additional languages into a TBX file, I have added the necessary elements to the file and configured the Multilingual XML file type as follows:

Screenshot of project settings in a software interface showing Multilingual XML file type configuration with language mappings for German, Turkish, Swedish, Slovenian, Slovak, Russian, Romanian, and Portuguese.

Note that I also added a languages parent element to have the required languages root:

Screenshot of an XML code snippet displaying term entries for languages including English, German, French, Spanish, and Dutch with tags for term, termNote, and langSet.

However, even though there are over 1700 German terms, only the first one is extracted:

Screenshot of a preview window in a software interface showing multiple entries of the German term 'Abgasfilter' extracted from a TBX file, indicating an issue with term extraction.

According to the XQuery Builder in oXygen, the XPath expression for de-DE should match 1792 different items, but Trados Studio extracts the first entry 1810 times, which is the number of termEntry elements in the file.

What am I missing?



Generated Image Alt-Text
[edited by: RWS Community AI at 1:10 PM (GMT 0) on 3 Feb 2025]
emoji
Parents
  • "Probability score": 0.7

    "Question improvement suggestion": Please provide the version of Trados Studio you are using and any error messages you may have encountered. Also, it would be helpful to know if you have made any recent changes to your system or software.

    In the meantime, based on the information you have provided, here is a suggested answer to your question:

    Hello,

    It seems like you have correctly set up the Multilingual XML file type and the XPath expressions. However, Trados Studio is not extracting all the German terms as expected. This could be due to a few reasons:

    Step 1: Check your XPath expression. Ensure that it is correctly written and that it matches the structure of your XML file. The XPath expression should be able to select all the German terms in your file.

    Step 2: Ensure that the 'Languages Root' and 'Languages' fields are correctly filled in the Multilingual XML file type settings. The 'Languages Root' should be the XPath to the parent element of the languages, and the 'Languages' field should contain the language codes of the languages you want to extract.

    Step 3: Check if there are any issues with the XML file itself. Sometimes, issues with the file structure or encoding can cause problems with the extraction of terms.

    Step 4: Try to update your Trados Studio to the latest version. Sometimes, issues can be resolved with the latest updates and patches.

    If you have followed all these steps and the issue still persists, it might be a more complex issue that needs further investigation.

    I hope this answer addressed your question. If not, please reject the answer, add the question improvement suggestion information, and click the RWS Community AI checkbox on the right to try again.

    RWS Community AI

    emoji
  •  

    If you want a response from the AI after it gave you the first answer you need to reject the answer before you finish your reply.

    On the question... in case it needs checking I'd recommend you always make it easy for anyone willing to help and prepare a small sample file... took me a lot longer than it would have probably taken you:

    <?xml version="1.0" encoding="UTF-8"?>
    <martif type="TBX" xml:lang="en">
      <text>
        <body>
          <!-- Term Entry 1 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>exhaust filter</term>
                  <termNote type="partOfSpeech">noun</termNote>
                  <termNote type="grammaticalNumber">one</termNote>
                  <termNote type="termType">fullForm</termNote>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Abgasfilter</term>
                  <termNote type="partOfSpeech">noun</termNote>
                  <termNote type="grammaticalGender">masculine</termNote>
                  <termNote type="grammaticalNumber">one</termNote>
                  <termNote type="termType">fullForm</termNote>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à gaz d'échappement</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de escape</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>uitlaatfilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 2 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>air filter</term>
                  <termNote type="partOfSpeech">noun</termNote>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Luftfilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à air</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de aire</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>luchtfilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 3 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>oil filter</term>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Ölfilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à huile</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de aceite</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>olie filter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 4 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>fuel filter</term>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Kraftstofffilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à carburant</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de combustible</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>brandstoffilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 5 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>cabin filter</term>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Innenraumfilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre d'habitacle</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de cabina</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>cabinefilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
        </body>
      </text>
    </martif>
    

    But this might not even be correct since we don't get to see a complete structure.  But based on my sample, I can get this:

    Screenshot of a table with two columns showing English and German terms for filters. There are visible errors with punctuation in the English terms.

    Only problem I can see with your XPath is that you used an absolute XPath expression where it is expressly explained you need a relative query:

    Screenshot of a software interface with a dropdown menu for language selection set to German (Germany) and a highlighted relative XPath query.

    The absolute expression is only needed to anchor to root.

    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


    Generated Image Alt-Text
    [edited by: RWS Community AI at 10:49 PM (GMT 0) on 3 Feb 2025]
Reply
  •  

    If you want a response from the AI after it gave you the first answer you need to reject the answer before you finish your reply.

    On the question... in case it needs checking I'd recommend you always make it easy for anyone willing to help and prepare a small sample file... took me a lot longer than it would have probably taken you:

    <?xml version="1.0" encoding="UTF-8"?>
    <martif type="TBX" xml:lang="en">
      <text>
        <body>
          <!-- Term Entry 1 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>exhaust filter</term>
                  <termNote type="partOfSpeech">noun</termNote>
                  <termNote type="grammaticalNumber">one</termNote>
                  <termNote type="termType">fullForm</termNote>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Abgasfilter</term>
                  <termNote type="partOfSpeech">noun</termNote>
                  <termNote type="grammaticalGender">masculine</termNote>
                  <termNote type="grammaticalNumber">one</termNote>
                  <termNote type="termType">fullForm</termNote>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à gaz d'échappement</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de escape</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>uitlaatfilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 2 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>air filter</term>
                  <termNote type="partOfSpeech">noun</termNote>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Luftfilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à air</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de aire</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>luchtfilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 3 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>oil filter</term>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Ölfilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à huile</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de aceite</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>olie filter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 4 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>fuel filter</term>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Kraftstofffilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre à carburant</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de combustible</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>brandstoffilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
          <!-- Term Entry 5 -->
          <termEntry>
            <languages>
              <langSet xml:lang="en-US">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>cabin filter</term>
                </tig>
              </langSet>
              <langSet xml:lang="de-DE">
                <descripGrp>
                </descripGrp>
                <tig>
                  <term>Innenraumfilter</term>
                </tig>
              </langSet>
              <langSet xml:lang="fr-FR">
                <tig>
                  <term>filtre d'habitacle</term>
                </tig>
              </langSet>
              <langSet xml:lang="es-ES">
                <tig>
                  <term>filtro de cabina</term>
                </tig>
              </langSet>
              <langSet xml:lang="nl-NL">
                <tig>
                  <term>cabinefilter</term>
                </tig>
              </langSet>
            </languages>
          </termEntry>
        </body>
      </text>
    </martif>
    

    But this might not even be correct since we don't get to see a complete structure.  But based on my sample, I can get this:

    Screenshot of a table with two columns showing English and German terms for filters. There are visible errors with punctuation in the English terms.

    Only problem I can see with your XPath is that you used an absolute XPath expression where it is expressly explained you need a relative query:

    Screenshot of a software interface with a dropdown menu for language selection set to German (Germany) and a highlighted relative XPath query.

    The absolute expression is only needed to anchor to root.

    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


    Generated Image Alt-Text
    [edited by: RWS Community AI at 10:49 PM (GMT 0) on 3 Feb 2025]
Children
No Data