如何在xsl中为不同的页面应用不同的页面宽度?这是用于生成PDF

时间:2013-03-21 07:04:44

标签: xslt xsl-fo

我必须使用xml和xsl生成pdf。 在PDF上我需要不同页面的不同宽度。 我怎么能做到这一点?

谢谢和问候

克里希南

1 个答案:

答案 0 :(得分:1)

完整的xsl-fo样本:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">  
                <fo:layout-master-set>
                    <fo:simple-page-master page-height="10cm" page-width="5cm" 
                            master-name="format1">
                        <fo:region-body />
                    </fo:simple-page-master>
                    <fo:simple-page-master page-height="5cm" page-width="10cm" 
                            master-name="format2">
                        <fo:region-body/>
                    </fo:simple-page-master>
                </fo:layout-master-set>
                <fo:page-sequence master-reference="format1">
                    <fo:flow flow-name="xsl-region-body">
                        <fo:block>Test format 1</fo:block>
                    </fo:flow>
                </fo:page-sequence>
                <fo:page-sequence master-reference="format2">
                    <fo:flow flow-name="xsl-region-body">
                        <fo:block>Test format 2</fo:block>
                    </fo:flow>
                </fo:page-sequence>
</fo:root>