-- 作者:wangsy0595
-- 发布时间:8/22/2005 6:45:00 AM
-- 请教如何在xsl-fo中设置中文?是否要在<fo:block>里面设置还是在外部设置
请教如何在xsl-fo中设置中文?是否要在<fo:block>里面设置还是在外部设置?? xml-->xsl--->pdf xml: <?xml version="1.0" encoding="gb2312"?> <projectteam> <projectname>王</projectname> <member> <name>John Doe</name> <function>lead</function> <email>jon.doe@killerapp.fun</email> </member> <member> <name>Paul Coder</name> <function>dev</function> <email>paul.coder@killerapp.fun</email> </member> <member> <name>Max Hacker</name> <function>dev</function> <email>max.hacker@killerapp.fun</email> </member> <member> <name>Donna Book</name> <function>doc</function> <email>donna.book@killerapp.fun</email> </member> <member> <name>Henry Tester</name> <function>qa</function> <email>henry.tester@killerapp.fun</email> </member> </projectteam> xsl: <?xml version="1.0" encoding="gb2312"?> <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:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/> <!-- ========================= --> <!-- root element: projectteam --> <!-- ========================= --> <xsl:template match="projectteam"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="simpleA4"> <fo:flow flow-name="xsl-region-body"> <fo:block font-size="16pt" font-weight="bold" space-after="5mm">Project: <xsl:value-of select="projectname"/> </fo:block> <fo:block font-size="10pt"> <fo:table table-layout="fixed"> <fo:table-column column-width="4cm"/> <fo:table-column column-width="4cm"/> <fo:table-column column-width="5cm"/> <fo:table-body> <xsl:apply-templates/> </fo:table-body> </fo:table> </fo:block> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> <!-- ========================= --> <!-- child element: member --> <!-- ========================= --> <xsl:template match="member"> <fo:table-row> <xsl:if test="function = 'lead'"> <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:if> <fo:table-cell> <fo:block> <xsl:value-of select="name"/> </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> <xsl:value-of select="function"/> </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> <xsl:value-of select="email"/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:template> </xsl:stylesheet> 请教如何设置中文?
|