需要XSL-FO表的圆角?

时间:2016-07-27 06:48:59

标签: xml xsl-fo apache-fop

我在XSL-FO模板语言的帮助下将XML数据转换为PDF文件,想要一个圆角的表头和数据表布局如下图所示 enter image description here

现在我只得到尖角使用了fox:border-radius属性,但是没有用。

我的XSL-FO:

    <?xml version="1.0" encoding="iso-8859-1"?>
  <xsl:stylesheet version="1.1"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
    exclude-result-prefixes="fo">
  <xsl:template match="root">
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
      <fo:simple-page-master master-name="my-page">
        <fo:region-body margin="1in"/>
      </fo:simple-page-master>
    </fo:layout-master-set>

    <fo:page-sequence master-reference="my-page">
      <fo:flow flow-name="xsl-region-body">
        <fo:block>Hello, <xsl:value-of select="name" />!</fo:block>
        <fo:block>
            <fo:table width="100%" fox:border-radius="4em" border=".125em solid #000000">
                 <fo:table-body>
                    <fo:table-row>
                    <fo:table-cell border="solid 1px black" 
            text-align="center" font-weight="bold">
                        <fo:block>
                            No.
                            </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border="solid 1px black" 
            text-align="center" font-weight="bold">
                        <fo:block>
                            Name
                            </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border="solid 1px black" 
            text-align="center" font-weight="bold">
                        <fo:block>
                            Phone Number
                            </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
              <fo:table width="100%" fox:border-radius="4em" border=".125em solid #000000">
              <fo:table-body>    
                  <xsl:for-each select="./friend">
                    <xsl:for-each select="./closefriends">
                    <fo:table-row>
                    <fo:table-cell border="solid 1px black" text-align="center">
                        <fo:block>
                            <xsl:value-of select="position()" />
                            </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border="solid 1px black" text-align="center">
                        <fo:block>
                            <xsl:value-of select="../name" />
                          <xsl:value-of select="names" />
                            </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border="solid 1px black" text-align="center">
                        <fo:block>
                            <xsl:value-of select="phNo" />
                            </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                  </xsl:for-each>
                  </xsl:for-each>
                 </fo:table-body>
            </fo:table>
        </fo:block>
      </fo:flow>
    </fo:page-sequence>
  </fo:root>
  </xsl:template>
  </xsl:stylesheet>

我不知道,我在这里缺少什么来实现桌子的圆形边框。

1 个答案:

答案 0 :(得分:0)

为了在FOP桌子上产生圆角,你必须修理两件事: