XPath query for content of an XML attribute

I use the file tye XML 2:OASIS DITA 1.3 in Trados Studio 2021 SR2 - 16.2.12.9338.

I have XML content that looks like this:

<othermeta content="Störung;Behebung;Leckage;Luftblase;Schlauch;Sensorfehler;Überdruckfehler;Systemflüssigkeit" name="keyword"/>

I need to make the content after content= translatable: Störung;Behebung;Leckage;Luftblase;Schlauch;Sensorfehler;Überdruckfehler;Systemflüssigkeit. The content is different in every file. The structure of the XML element is always <othermeta content="" name="keyword"/>

I have been struggling to define an XPath query; I'm not even sure this sort of filtering can be done with an XPath query...

emoji
Parents
  •  

    I made up a file like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA 1.3//EN" "www.oasis-open.org/.../topic.dtd">
    <topic id="exampleTopic">
        <title>Getting at content</title>
        <prolog>
            <metadata>
                <othermeta content="Störung;Behebung;Leckage;Luftblase;Schlauch;Sensorfehler;Überdruckfehler;Systemflüssigkeit" name="keyword"/>
            </metadata>
        </prolog>
        <body>
            <p>Extract the content attribute</p>
        </body>
    </topic>

    Added a rule like this:

    //*/othermeta/@content

    Looks like this showing the content of the content attribute, when part of the othermeta element, extracted for translation:

    Trados Studio preview window showing XML content with a title 'Getting at content' and a list of keywords separated by semicolons in the metadata section.

    I guess you could easily create a segmentation rule in your TM to segment on the semi-colon so it's easier to translate and leverage in the future.

    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



    Generated Image Alt-Text
    [edited by: Trados AI at 9:28 AM (GMT 0) on 27 Feb 2024]
Reply
  •  

    I made up a file like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA 1.3//EN" "www.oasis-open.org/.../topic.dtd">
    <topic id="exampleTopic">
        <title>Getting at content</title>
        <prolog>
            <metadata>
                <othermeta content="Störung;Behebung;Leckage;Luftblase;Schlauch;Sensorfehler;Überdruckfehler;Systemflüssigkeit" name="keyword"/>
            </metadata>
        </prolog>
        <body>
            <p>Extract the content attribute</p>
        </body>
    </topic>

    Added a rule like this:

    //*/othermeta/@content

    Looks like this showing the content of the content attribute, when part of the othermeta element, extracted for translation:

    Trados Studio preview window showing XML content with a title 'Getting at content' and a list of keywords separated by semicolons in the metadata section.

    I guess you could easily create a segmentation rule in your TM to segment on the semi-colon so it's easier to translate and leverage in the future.

    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



    Generated Image Alt-Text
    [edited by: Trados AI at 9:28 AM (GMT 0) on 27 Feb 2024]
Children