首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么princexml中的样式不适用于xml

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

Stack Overflow用户
提问于 2019-12-27 09:40:28
回答 1查看 92关注 0票数 0

我有一些XML:

代码语言:javascript
复制
<?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:

代码语言:javascript
复制
<?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?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-27 10:20:00

Prince不支持XSL,它支持CSS。请使用XSLT处理器首先转换XML,然后将结果传递给Prince。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59498741

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档