![](/img/trans.png)
[英]how to apply xsl styles to an embedded xml inside html with javascript
[英]Why styles don't apply to xml inside princexml
我有一些 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 時: 為什么樣式不適用於
princexml
xml?
Prince 不支持 XSL,它支持 CSS。 請先使用 XSLT 處理器轉換 XML,然后將結果傳遞給 Prince。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.