xsl:template - 如何从右到左呈现页面?

xsl:template - How to render the page from right to left?

我有 xsl:template 当前正在从 left to right 渲染,我希望从 right to left 渲染它。

<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:report="http://caretalks.somecompanyname.com/IET/2007/12"
    xmlns:Parse="com.somecompanyname.caretalks.util.StringParserUtils"
    xmlns:Ext="com.somecompanyname.caretalks.util.XsltUtils"
    exclude-result-prefixes="fo">


    <xsl:template match="report:memberEngagementReport">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
          <fo:layout-master-set>
            <fo:simple-page-master master-name="simpleA" page-height="11in"
                    page-width="8.5in" margin-top="0.5cm" margin-bottom="0.5cm"
                    margin-right="0.5cm" margin-left="0.5cm"
                    writing-mode="{$writingMode}">
                <fo:region-body margin-top="1cm" margin-bottom="2.6cm"
                        margin-right="1.5cm" margin-left="1.5cm"/>
                <fo:region-before extent="0.5cm"/>
                <fo:region-after extent="2.0cm"/>
            </fo:simple-page-master>
          </fo:layout-master-set>

    .
    .
    .
    .
    </xsl:template>
</xsl:stylesheet>

我在网上搜索了可能的解决方案,但找不到我需要的。

我该怎么做才能渲染它right to left

我也在寻找为两侧 (LTR / RTL) 渲染它并维护一个原始 XSL 文件的方法。

writing-mode 是继承的,因此在 fo:root 上设置 writing-mode="rl" 以将其应用于整个文档。参见 https://www.w3.org/TR/xsl11/#writing-mode

你好像在使用FOP,所以如果你想让不同区域的内容有不同的书写模式,你不能使用from-page-master-region()从页面区域获取书写模式。但是,由于您有一个用于书写模式的变量,您可以在每个 fo:flowfo:static-content.

上设置 writing-mode