xml - 为什么样式不适用于princexml中的xml
问题描述
我有一些 XML:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="./example.xsl"?>
<article>
<title>Some title</title>
<author>Some Author</author>
</article>
和 XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="html" />
<xsl:template match="/">
<h1>
<xsl:value-of select="//title"/>
</h1>
<h2>
<xsl:value-of select="//author"/>
</h2>
</xsl:template>
</xsl:stylesheet>
但是我需要从此 XML 生成 PDF,因此我应该使用princexml
,当我运行 prince ./examples/example.xml
生成包含以下内容的 pdf 时:
为什么样式不适用于里面的 xml princexml
?
解决方案
Prince 不支持 XSL,它支持 CSS。请先使用 XSLT 处理器转换 XML,然后将结果传递给 Prince。
推荐阅读
- android - 如何限制用户从 Android 设备的文件资源管理器中查看/访问缓存文件?
- python - 无法使用python在网格布局中抓取包含分页和产品的页面
- spring - 从 Spring Security 2.0 迁移到 3.0:AbstractProcessingFilter.setServerSideRedirect() 会发生什么?
- javascript - 如何从另一个html文件调用一个html文件中的函数
- r - R 包,用于在描述性统计中发布准备好的汇总表,并带有 LaTeX 和其他编辑器的导出选项?
- python - MacOS 上的 Tkinter 错误:无法识别的选择器发送到实例 0x7fcbd5d9c1d0
- angular - 如何在 Angular 中处理从端点获取的一般项目和项目?
- json - 在golang中动态从JSON中删除密钥
- android - 如何修复“找不到 okhttp3.HttpUrl 的类文件”?
- javascript - 当鼠标离开两个不同的块时隐藏工具提示