format2rtlAdded by IBM on October 10, 2012 | Version 1 (Original)
|Ensures that the text before each delimiter is displayed in a right-to-left direction. This function is needed when the order of your text does not match the order specified by the Unicode Bidirectional Algorithm (UBA).
This function checks the string to see if direction control characters already exist in the string to avoid inserting duplicated controls.
This function can be written as an XFDL compute or XPath expression.
Table 1. 2 format2rtl parameters
|reference||Reference string, literal string or XPath expression||a literal string or reference to the text that you want to apply the function to.|
|delimiter||Symbol or character||special symbol or character that marks the beginning or end of a unit of data. For example, forward slash (/).|
String containing a formatted text in rtl (Right-To-Left) orientation.
The format2rtl function can be used in three ways:
- XFDL computes
- XPath expressions
- XForm binds
In the following example, assume that capital letters indicate Left -To-Right text. As you can see, the text string in the compute shows month/year/day. This is the direction that the Unicode Bidirectional Algorithm assumed that the text should take when it encountered the string 2007/MAY/19. The Unicode Bidirectional Algorithm parsed the 19 in a Left-To-Right direction, but switched to Left -To-Right text direction when it encountered the Left -To-Right text in MAY. The Left -To-Right direction continued when it reached 2007, which can be rendered as both Left-To-Right and Right-To-Left text and therefore gives no strong directional cues to the Unicode Bidirectional Algorithm. As a result, the Unicode Bidirectional Algorithm places the year after the month.
With format2rtl, we can override the Unicode Bidirectional Algorithm so that the date is displayed in a Right-To-Left order (2007/MAY/19) by inserting Right-To-Left Unicode control characters before the / delimiter.
<value compute="format2rtl('MAY/2007/19','/' )"></value>
The following example uses an XPath expressions to call the format2rtl function:
The following example uses an XPath expression in a bind to call the format2rtl function:
value="xfdl: format2rtl ("MAY/2007/19",'/')">
calculate="xfdl: format2rtl ("MAY/2007/19",'/')">