Assign a length restriction attribute from one element to another using Xpath

Hi,

 

First of all, thanks to Paul for the illuminating article on length restriction. https://multifarious.filkin.com/2014/05/02/xml-length-restrictions/

In my case though, the attribute I want to use as length restriction rule for my translatable segments <target> is in another node like this:

 

<trans-unit id="01">

  <target>Text</target>

  <context-group name=" extract">

    <context context-type="x-length"> 10 PX </context>

  </context-group>

</trans-unit>

 

I know I can select the x-length attribute using this Xpath expression:

//context[@context-type='x-length']

 

But I can't figure out what to put in the "edit" and "advanced" tabs of the //target parser rule settings of my custom file type, so that the translatable segment picks up on the length restriction value and shows it the document structure column. I would very much like to be able to use the QA Checker length restriction option to check for this.

Any help would be greatly appreciated.

 

*Edit: typo

Parents
  • Hi ,

    I don't think this is possible (with XPATH alone) because you'd need to pick up a variable value out of the text " 10 PX " inside the context element. It's unfortunate the developer didn't write the XML in a more usable way, even just like this would have been better (untested, but I think it would be possible):

    <context context-type="x-length">10</context>

    Perhaps you can make use of a stylesheet instead and show the value in the preview? Doesn't help wrt the automatic QA length check but its similar to having it as a visual check in the DSI column.

    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

Reply
  • Hi ,

    I don't think this is possible (with XPATH alone) because you'd need to pick up a variable value out of the text " 10 PX " inside the context element. It's unfortunate the developer didn't write the XML in a more usable way, even just like this would have been better (untested, but I think it would be possible):

    <context context-type="x-length">10</context>

    Perhaps you can make use of a stylesheet instead and show the value in the preview? Doesn't help wrt the automatic QA length check but its similar to having it as a visual check in the DSI column.

    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

Children