SDL Trados Studio
SDL Trados GroupShare
SDL Trados Business Manager
SDL Trados Live
SDL Speech to Text
SDL Managed Translation - Enterprise
Translation Management Connectors
SDL LiveContent S1000D
SDL Contenta S1000D
SDL Tridion Docs
SDL Tridion Sites
SDL Content Assistant
SDL Machine Translation Cloud
SDL Machine Translation Connectors
SDL Machine Translation Edge
Tridion Docs Developers
SDL User Experience
Language Products - GCS Internal Community
SDL Community Internal Group
SDL Access Customer Portal
SDL Professional Services
Language Technology Partner Group
SDL Academic Partners
SDL Enterprise Technology Partners
ETUG (European Trados User Group) Public Information
Machine Translation User Group
Nordic SDL Tridion Docs User Group
SDL Tridion UK Meetup
SDL Tridion User Group New England
SDL Tridion West Coast User Group
SDL WorldServer User Group
Tridion Docs Europe & APAC User Group
Tridion User Group Benelux
Tridion User Group Ohio Valley
SDL MultiTerm Ideas
SDL Passolo Ideas
SDL Trados GroupShare Ideas
SDL Trados Studio Ideas
SDL Machine Translation Cloud Ideas
SDL Machine Translation Edge Ideas
SDL Language Cloud TMS Ideas
SDL Language Cloud Terminology Ideas
SDL Language Cloud Online Editor Ideas
SDL Managed Translation - Enterprise Ideas
SDL TMS Ideas
SDL WorldServer Ideas
SDL Tridion Docs Ideas
SDL Tridion Sites Ideas
SDL LiveContent S1000D Ideas
SDL Contenta S1000D
SDL XPP Ideas
Events & Webinars
To SDL Documentation
To SDL Support
To SDL Training
Training & Certification
What's New in SDL
Detecting language please wait for.......
I'm trying to create a custom XML file type to extract part of an XML attribute value. To make things a bit more complicated, the attribute value is actually an XPath too.
Suppose this XML file:
<root><Attribute XPath="//Buttons[@Display='Name']" /></root>
I want to translate only Name.
It's easy enough to extract the entire attribute value. Just add //Attribute/@XPath to the parser, and the editor will show //Buttons[@Display='Name'].
I was trying to get rid of the irrelevant section by means of the embedded content processor:* Document structure information: Tag (x-tm-tag)* Tag definition rules** Start Tag Expression: \/\/Buttons\[@Display='** End Tag Expression: '\]
However, I still get the entire attribute value. I can't get the embedded content processor to work... I also tried easier tag definition rules, but it doesn't kick in.
Or am I on the wrong track and should I try thing with a more advanced parser rule?
Any advice would be greatly appreciated!
Ken De Wachter said:Document structure information: Tag (x-tm-tag)
This part is incorrect. The "Tag" here means something completely different.
What you need to put here is what you have specified in your parser rule.E.g. in my example I have specified that the parser rule extracts an "Element", so this is what I need to specify in the Embedded Content Processor:
Thanks, that makes sense. I tried it and it works for elements.
However, there it does not work for attributes:
I specify the context information for attribute values as Element:
Yet it still appears as a tag in the editor:
Just to be on the safe side, I added Element (sdl:element) and Tag (x-tm-tag) to the Document structure information of the Embedded content processor.
Ken De Wachter
I think your problem is that embedded content is not supported for attributes.
Your best bet is to post-process the file, perhaps using something like the SDL Data Protection Suite, or Clean up Tasks from the appstore.
So simply use "Custom" when defining your parser rule and define your own values. And then use the "Identifier" you define there in the Embedded Content Processor settings.
EDIT:Paul is right, I keep forgetting that for some weird and unknown reason attribute values cannot be passed to Embedded Content Processor.Why? That's a mystery... Embedded Content Processor shouldn't absolutely care about the source of the string being passed into it... it should be just a string, nothing else, no matter what's its origin... a string should be a string...
That's a pity... What was the logic for not supporting embedded content in attribute values?
Do you think it's doable using a parser rule? I tried using substring-after, but I can't get it to work properly (I haven't even tried to fix the apostrophes in the attribute value yet...):
This parser rule doesn't give any result in Studio, though it works in XPath validators: substring-after(//Attribute/@XPath,'Display=')
I also considered the SDL Data Protection Suite, but I want to avoid running the batch task separately. If I include the Protect batch task in a task sequence (Prepare and Protect), it works great. The tags aren't even visible in the editor! However, I can't unprotect anymore so the content disappears from my target file... I guess this relates to one of my earlier questions (https://community.sdl.com/product-groups/translationproductivity/f/openexchange_applications/20645/bug-in-when-executing-protect-batch-task-in-task-sequence---sdl-data-protection-suite-project-anonymizer). Some great advances have been made, but we're not there yet (c: