pdf - xsl:template - 如何从右到左呈现页面?
问题描述
我有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
是继承的,所以设置它writing-mode="rl"
以fo:root
应用于整个文档。请参阅https://www.w3.org/TR/xsl11/#writing-mode。
你好像用的是FOP,所以如果你想让不同区域的内容有不同的写模式,你不能用from-page-master-region()
从页面区域获取写模式。但是,由于您有一个用于书写模式的变量,您可以writing-mode
在每个fo:flow
或上设置fo:static-content
。
推荐阅读
- javascript - 使用 ajax 从烧瓶到 javascript 的图像
- mysql - 超过锁定等待超时;尝试重新启动事务 - 插入语句
- python - 我在为 python 使用 beautifulsoup 包时遇到了麻烦
- javascript - 为什么我的 JSON 响应在另一个函数中无法识别?
- javascript - 基于条件的动态行选择
- swift - Swift枚举,从关联的枚举中获取原始值
- java - 静态块和静态内存初始化和实现
- vb.net-2010 - 如何使用 do while 循环获得两种产品的奖品
- php - 如果在数据库中找到卡号,是否进行交易?
- python - 没有包的 Python 中的序列整数矩阵