我是Apache-FOP的新手。
我用它来从XML输入生成PDF文档。我为输入XML创建了XSL并获取了###值而不是阿拉伯语文本。任何人都可以指出错误吗?我有一套字体,但仍然无法得到正确的结果。
XML输入:
<TestData>
<TestXML>
<Name>Sathish நன்றி</Name>
<Dept>Channels</Dept>
<Year>2016</Year>
</TestXML>
<TestXML>
<Name>Sathish dėkoju</Name>
<Dept>Channels</Dept>
<Year>2016</Year>
</TestXML>
<TestXML>
<Name>Sathish благодаря</Name>
<Dept>Channels</Dept>
<Year>2016</Year>
</TestXML>
<TestXML>
<Name>Sathish شكر</Name>
<Dept>Channels</Dept>
<Year>2016</Year>
</TestXML>
</TestData>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-portrait" page-height="29.7cm" page-width="21.0cm" margin="2cm">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-portrait">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-header>
<fo:table-row background-color="#c0c0c0" height="0.59cm">
<fo:table-cell number-columns-spanned="1">
<fo:block margin-left="0.0cm" margin-right="0.14cm" margin-top="0.0cm" font-size="10pt" color="#000000" text-align="left">Name</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="1">
<fo:block margin-left="0.51cm" margin-right="0.16cm" margin-top="0.0cm" font-size="10pt" color="#000000" text-align="left">Department</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="1">
<fo:block margin-left="0.0cm" margin-right="2.65cm" margin-top="0.0cm" font-size="10pt" color="#000000" text-align="left">Year</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:for-each select="TestData/TestXML">
<fo:table-row background-color="#ffffff" height="0.57cm">
<fo:table-cell number-columns-spanned="1">
<fo:block margin-left="0.0cm" margin-right="0.14cm" margin-top="0.0cm" font-size="10pt" color="#000000" text-align="left">
<xsl:value-of select="Name" />
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="1">
<fo:block margin-left="0.0cm" margin-right="0.14cm" margin-top="0.0cm" font-size="10pt" color="#000000" text-align="left">
<xsl:value-of select="Dept" />
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="1">
<fo:block margin-left="0.0cm" margin-right="0.14cm" margin-top="0.0cm" font-size="10pt" color="#000000" text-align="left">
<xsl:value-of select="Year" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
myConf.xconf:
<fop>
<renderers>
<renderer mime="application/pdf">
<fonts>
<auto-detect/>
</fonts>
</renderer>
</renderers>
</fop>
警告:
2016年8月12日下午4:47:31 org.apache.fop.events.LoggingEventListener processEvent 警告:雕文&#34;?&#34; (0xba8)字体不可用&#34; Helvetica&#34;。 2016年8月12日下午4:47:31 org.apache.fop.events.LoggingEventListener processEvent 警告:雕文&#34;?&#34; (0xba9)字体不可用&#34; Helvetica&#34;。 2016年8月12日下午4:47:31 org.apache.fop.events.LoggingEventListener processEvent 警告:雕文&#34;?&#34; (0xbcd)字体不可用&#34; Helvetica&#34;。 2016年8月12日下午4:47:31 org.apache.fop.events.LoggingEventListener processEvent 警告:雕文&#34;?&#34; (0xbb1)字体不可用&#34; Helvetica&#34;。
结果: Sathish #####频道2016 Sathish d#koju Channels 2016 Sathish #########频道2016