我在XSL-FO模板语言的帮助下将XML数据转换为PDF文件,想要一个圆角的表头和数据表布局如下图所示
现在我只得到尖角使用了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>
我不知道,我在这里缺少什么来实现桌子的圆形边框。
答案 0 :(得分:0)
为了在FOP桌子上产生圆角,你必须修理两件事:
fox
名称空间前缀的声明,绑定到http://xmlgraphics.apache.org/fop/extensions
(请参阅http://xmlgraphics.apache.org/fop/trunk/extensions.html#fox-namespace)。 border-collapse
属性的值设置为“分隔”(请参阅http://xmlgraphics.apache.org/fop/trunk/extensions.html#rounded-corners)。