简体   繁体   English

为什么样式不适用于princexml中的xml

[英]Why styles don't apply to xml inside princexml

I have some 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>

and XSL:和 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>

When I am running this on the browser I have this:当我在浏览器上运行它时,我有这个: 在此处输入图片说明

But I need to generate PDF from this XML, therefore I should use princexml , when I am running prince ./examples/example.xml generate pdf with this content:但是我需要从这个 XML 生成 PDF,因此我应该使用princexml ,当我运行prince ./examples/example.xml生成带有以下内容的 pdf 时: 在此处输入图片说明 Why styles does not apply to xml inside princexml ?为什么样式不适用于princexml xml?

Prince does not support XSL, it supports CSS. Prince 不支持 XSL,它支持 CSS。 Please use an XSLT processor to convert the XML first, then pass the result to Prince.请先使用 XSLT 处理器转换 XML,然后将结果传递给 Prince。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM