The built-in XPath function, ng:bidiSwap() reverse the order of characters of the input string. following the rules for bi-directional texts. This can be used as a workaround in scenarios where a text is displayed incorrectly.
This function is only available when the sample input is a spooled file, as the problem this solves should only happen with spooled input.
Example:
This call:
ng:bidiSwap('مرحبا بالعالم')returns the text: