Xpath query

I have this Xml file:


<trans-unit>
<note>Catch this</note>
</trans-unit>
<trans-unit>
<note>Do not catch this</note>
</trans-unit>

This is my Xpath query: //note[not(contains(text(),'Do not catch this'))]

Which works outside of Studio:

Screenshot of Trados Studio showing an XPath query and the XML file with two trans-unit elements, one being highlighted as a result of the query.

..but not in Studio.

Screenshot of Trados Studio parser settings displaying the XPath rule, its translation setting as 'Always translatable', and the tag type as 'structure'.

Any ideas?

Thanks

Samuel



Generated Image Alt-Text
[edited by: Trados AI at 4:42 AM (GMT 0) on 5 Mar 2024]
emoji
Parents Reply Children
  • I have an update on this in two parts.

    1. the fact you have to use local-name and can't use the namespace prefix is a confirmed bug.  I'll have a bug number for this in due course... hopefully next week.
    2. the use of embedded content problem is only a problem because I didn't now how to work around it.  According to support this is the intended behaviour because when using embedded content the text moves from the xml filter to the html one where there is no option for comments.

    There is a way to deal with this though by using the feature to tackle it through a defined document structure.  So you add structure like this for example:

    Trados Studio Edit Rule dialog showing an XPath rule with a red arrow pointing to the 'Body' structure information property.

    Then use this option for the embedded content:

    Trados Studio Project Settings dialog with Embedded Content section highlighted, showing 'Defined by document structure information' selected.

    Unfortunately this means you can't use the embedded content filetypes such as HTML and will have to create the rules you need.  Not a bug, but definitely worth raising as an enhancement idea.

    It also means you get a pretty horrible experience if there is embedded content on the comments:

    Trados Studio Comments window displaying two errors related to embedded content in XML comments.

    But it does work.

    A long old thread and quite a lot of useful information in here I think.

    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: Trados AI at 4:42 AM (GMT 0) on 5 Mar 2024]