如何解决在XSL FO文档中编写XSL-t
| 我是XSL FO的初学者。 我有一个非常简单的XML文档:<?xml version= \"1.0\" ?>
<test>
TEST
</test>
我想在标签“ 1”之间打印内容
我编写了以下XLS FO文档,以供FOP处理。
<fo:root xmlns:yt=\"http://www.yseop.com/text/2\"
xmlns:y=\"http://www.yseop.com/engine/3\"
xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">
<fo:layout-master-set>
<fo:simple-page-master master-name=\"rapport\">
<fo:region-body margin-top=\"0.75in\" margin-left=\"0.75in\" margin-right=\"0.75in\" margin-bottom=\"0.75in\"/>
<fo:region-after extent=\"0.25in\"/>
<fo:region-start/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference=\"rapport\">
<fo:flow flow-name=\"xsl-region-body\">
<fo:block>
XXX
<xsl:apply-templates select=\"document(\'D:\\XXX-conseilVente\\xmlBatch\\input_test1.xml\')/test\"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
我收到以下警告:
[fop] 25 mai 2011 12:05:10 org.apache.fop.events.LoggingEventListener processEvent
[fop] ATTENTION: Unknown formatting object \"{http://www.w3.org/1999/XSL/Transform}apply-templates\" encountered (a child of fo:block}. (See position 22:99)
而且我的输出pdf上没有任何内容。
我想我没有使用正确的功能来用xsl-t解析文档
您能告诉我使用什么功能吗?
提前致谢
解决方法
XSLT和XSL-FO是两种不同的语言。基本上,它的工作方式与您目前所做的相反:FO嵌入XSLT样式表中,然后该样式表用于处理原始XML以创建XSL-FO文档(不包含任何XSLT)。这被扔给XSL-FO处理器来创建例如PDF。
XSLT processing
| |
XML ---> XSL-FO ---> PDF
因此,您从这样的XSLT样式表开始(没有名称空间之类,只是为了给您一个主意):
<xslt:stylesheet>
<xslt:template match=\"/\">
<fo:root>
<!-- fo head -->
<fo:page-sequence>
<fo:flow>
<xslt:apply-templates /> <!-- process the rest of the doc-->
</fo:flow>
</fo:page-sequence>
</fo:root>
</xslt:template>
<xslt:template match=\"test\">
<fo:block>
<xslt:value-of select=\".\" />
</fo:block>
</xslt:template>
</xslt:stylesheet>
您可以在Dave Pawson的XSL FAQ中找到许多问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。