How to disable output escaping while mapping XML to XML
Question asked by Daniel Hug - 4/10/2024 at 3:43 PM
Answered
While mapping XML to XML, I want to achieve disable-output-escaping="yes" for some nodes. How can I do that?
Liquid Support Replied
Employee Post
Hi,

You would need to manually edit the generated xslt.

May I ask why you would want to do this?
Daniel Hug Replied
Thanks. Use-case is preparing files for translation. HTML is embedded in XML, twice encoded, i.e. <p>Dies ist sehr umständlich</p> is encoded as <p>Dies ist sehr umst&auml;ndlich</p> and then as &lt;p&gt;Dies ist sehr umst&amp;auml;ndlich&lt;/p&gt;, so as not to break the XML.
The first encoding is necessary because of HTML. (What if wanted to write “The paragraph element looks like this: <p>.” — obviously the carets need to be encoded.)
The second encoding is necessitated by embedding it in the XML. (This might all be glaringly obvious if you are a specialist, which I am not.)
The translation software parses the XML and hands over the translatable content to a content processor, which decodes the HTML. In this second step, &lt; will be decoded to <, but &amp;auml; will be decoded to &auml;, which is awkward for the translator to work with.
In order to overcome this, all twice-escaped characters have to be unescaped once. (This has to be reverted on the return trip, of course. Currently all done with Regex.)
Liquid Support Replied
Employee Post
OK, thanks, I have asked the dev team to review this request.
Liquid Support Replied
Employee Post
I can confirm that this new functionality will be available in the next release.
Daniel Hug Replied
Wow, you are amazing! Is that the next major version or the next minor update - when (approx.) will this feature be available?
Liquid Support Replied
Employee Post Marked As Answer
This functionality has been added in v20.7.9...


Reply to Thread