For our PDF user guides, we use <codeblock> for code and XML samples and type spaces for indenting. These turn out fine in left-to-right languages, and the spaces indent the text as expected. But in Arabic, the spaces are stripped out when the text is aligned against the right (start) side in the PDF. Also, the closing bracket of the last line is misplaced.
Here is the <codeblock> as appears in our source DITA file:
<codeblock><ExpressAccess>
<Class>ExpressAccess</Class>
<Version>1</Version>
<Members>
<DisableAllAdmin>0</DisableAllAdmin>
</Members>
</ExpressAccess></codeblock>
And this is the XSLT we use to render it:
<fo:block xsl:use-attribute-sets="pre">
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="setFrame"/>
<xsl:call-template name="setScale"/>
<xsl:call-template name="setExpanse"/>
<fo:bidi-override direction="ltr" unicode-bidi="bidi-override">
<xsl:apply-templates/>
</fo:bidi-override>
</fo:block>
Here is the output in a left-to-right language:
But in Arabic, the output looks like this:
Here is the resulting FO code for both cases:
<fo:block background-color="#D9D9D6" font-size="9pt" line-height="106%" linefeed-treatment="preserve" space-after="0.6em" space-before="0.6em" text-align="start" white-space-collapse="false" white-space-treatment="preserve" wrap-option="wrap" line-height-shift-adjustment="disregard-shifts" font-family="Courier New"><fo:bidi-override direction="ltr" unicode-bidi="bidi-override"><ExpressAccess>
<Class>ExpressAccess</Class>
<Version>1</Version>
<Members>
<DisableAllAdmin>0</DisableAllAdmin>
</Members>
</ExpressAccess></fo:bidi-override></fo:block>
This was generated with DITA OT 3.6.1 with the accompanying FOP 2.5. Any help is appreciated. Thank you.
UPDATE: I gave the fix Kevin Brown provided a try. When I added text-align="left" to the block, the codeblock was aligned to the left with the spaces and indents preserved. But the last line still had the problem with the misplaced closing bracket (< </ExpressAccess). When I added text-align-last="left", it shoved the whole code back to the right and removed the space. (Setting text-align-last to "preserve" didn't break the code, but didn't fix misplaced closing bracket.) If I type any character after that closing bracket, it is formed correctly. Any suggestions?


I believe you have text-align and text-align-last set at a higher level which is causing the code block to be right aligned. I did this:
Which yields this result: