我有一些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,因此,当我运行具有以下内容的prince ./examples/example.xml generate时,我应该使用prince ./examples/example.xml:

为什么样式不适用于princexml内部的xml?
发布于 2019-12-27 10:20:00
Prince不支持XSL,它支持CSS。请使用XSLT处理器首先转换XML,然后将结果传递给Prince。
https://stackoverflow.com/questions/59498741
复制相似问题