SDL Trados Studio
SDL Trados GroupShare
SDL Trados Business Manager
SDL Trados Live
SDL MultiTerm
SDL Passolo
SDL Speech to Text
SDL Managed Translation - Enterprise
SDL MultiTrans
SDL TMS
SDL WorldServer
Translation Management Connectors
SDL LiveContent S1000D
SDL Contenta S1000D
SDL XPP
SDL Tridion Docs
SDL Tridion Sites
SDL Content Assistant
SDL Machine Translation Cloud
SDL Machine Translation Connectors
SDL Machine Translation Edge
Language Developers
Tridion Developers
Tridion Docs Developers
Xopus Developers
Community Help
SDL User Experience
Language Products - GCS Internal Community
SDL Community Internal Group
SDL Access Customer Portal
SDL Professional Services
SDL Training & Certification
Style Guides
Language Technology Partner Group
SDL Academic Partners
SDL Enterprise Technology Partners
XyUser Group
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 XPP Ideas
Events & Webinars
To SDL Documentation
To SDL Support
What's New in SDL
Detecting language please wait for.......
Hi! I am currently trying to optimize our XML parser rules for WorldServer V11.3.5.4758. Since this is an XPATH question, I thought I would post it here as I'm having no joy figuring this out by myself.
Basically, I have the following situation. Embedded in our XML files are some HTML tags, which we have handled up until now using the parser rules for our XML file type in WorldServer. I would like to keep it this way, if possible. So we are seeing tags like <B>, <U>, etc. What I want to optimize our the <BR/> tags.
Basically, I want them to break but allow a possible merge. This is no problem and is easily handled by setting //BR to "Inline" and "Exclude". However, if the <BR/> tag comes immediately following a comma, I would like to have these units automatically merged together, as this is a strong indicator that the units belong together.
Example:
<field attribute="f1463782524627-art"> <value> <U> <B>Sicherer digitaler Eingang: </B> <space/> </U> <BR/>Typ B, Sink Beschaltung, einstellbarer SW-Eingangsfilter<BR/> <U> <B>Sicherer analoger Eingang: </B> <space/> </U> <BR/>Typ B, Messbereich 0 bis 10 V / 0 bis 32 V / 0 bis 20 mA<BR/> <U> <B>Digitaler Eingang (ohne Diagnose): </B> <space/> </U> <BR/>Digitale Eingänge, Sink/Source Beschaltung pro Kanal konfigurierbar, einstellbarer SW-Eingangsfilter,<BR/>fix oder ratiometrisch einstellbare Schaltschwelle, Drahbruch und Kurzschlusserkennung<BR/> <U> <B>Digitaler Eingang (mit Diagnose):</B> <space/> </U> <BR/>Digitale Eingänge, einstellbarer SW-Eingangsfilter, Drahtbruch und Kurzschlusserkennung<BR/> <U> <B>Analoger Eingang:</B> <space/> </U> <BR/>Analoge Eingänge, Messbereich 0 bis 10 V / 0 bis 32 V / 0 bis 20 mA / 4 bis 20 mA / 1 bis 50 kΩ / Temperatureingänge, einstellbarer Analogfilter, <BR/>einstellbare Rampenbegrenzung, einstellbare Schwellenwerte, integrierter Eingangsschutz</value> </field>
Sorry, I know it's not well-indented and probably not well-formed, but I hope it gets my point across (I've included all of this to show the full context). I would like this unit to be automatically merged:
<BR/>Digitale Eingänge, Sink/Source Beschaltung pro Kanal konfigurierbar, einstellbarer SW-Eingangsfilter,<BR/>fix oder ratiometrisch einstellbare Schaltschwelle, Drahbruch und Kurzschlusserkennung<BR/>
so that it looks like this:
Digitale Eingänge, Sink/Source Beschaltung pro Kanal konfigurierbar, einstellbarer SW-Eingangsfilter,<BR-TAG>fix oder ratiometrisch einstellbare Schaltschwelle, Drahbruch und Kurzschlusserkennung
I've tried this, but it's not working:
//BR[ends-with(preceding::text()[1],',')]
(I've also tried preceding-sibling with no joy.)
I hope someone can help show me the way!
Thanks for the reminder, Paul!
Michael, can you run a test with this (XPath 1.0) expression:
//BR[preceding-sibling::text()[1][',' = substring(.,string-length(.) - string-length(',')+1)]]
and let us know…
Michael Schroeder
Michael, try this one instead:
//BR[preceding-sibling::text()[1][ends-with(.,',')]]
-- Rudi
Michael Schroeder said:Are there any plans to update to a higher version of XPATH in Studio / WorldServer?
As far as I'm aware there are not. But Patrik Mazanek would be the best person to confirm…
Thanks for that, Rudi! According to the XPATH online testing site I use, this XPATH is indeed the correct one. Unfortunately, WorldServer can't seem to get its head around it so it basically doesn't work. I did a quick test in Trados Studio 2019 and it didn't work there either. So now I'm wondering if this is a known issue, whether this is a "feature" (for some reason), or whatnot. Does anyone happen to have any information about this, like whether this functionality will be added in a future version of Trados Studio / WorldServer? Maybe Paul Filkin?
Thanks again for your fantastic help! If nothing else, I learned a bit more about XPATH!
Michael Schroeder Rudi Gebruers
The problem with this statement is it's based on functions only available with XPath 2.0 and Studio does not support this. So you'll need to find a solution using XPath 1.0 instead.
and let us know about the result?
Oh my, that is some serious wizardry...and it works!! Can't thank you enough, Rudi!
Thanks for this info, Paul! Are there any plans to update to a higher version of XPATH in Studio / WorldServer?
As far as I'm aware there are not. But Patrik Mazanek would be the best person to confirm this.
We depend on Microsoft not having this support in the .NET so we are not planning to add it now.
Thanks for this Rudi Gebruers... it's great to see some of these really interesting usecases and how XPath can be used to solve them if you know what you're doing. You certainly do, so thanks for sharing it.