【发布时间】:2014-08-30 19:24:45
【问题描述】:
我有一个连接到 XSL 文件的 XML 文件。当我打开 XML Firefox 并且 IE 可以加载它并毫无问题地显示它,但 Opera 22.0 只显示一个空白页面。
这是我的 XML:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="bibliography.xsl"?>
<bibliography xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="bibliography.xsd">
<phdthesis>
<name>
Abadie:92
</name>
<author>
B. Abadie
</author>
<title>
On the K-theory of non-commutative Heisenberg manifolds
</title>
<school>
Univ. of California at Berkeley
</school>
<year>
1992
</year>
</phdthesis>
<inproceedings>
<name>
Abadie:94
</name>
<author>
B. Abadie
</author>
<title>
''Vector bundles'' over quantum Heisenberg manifolds
</title>
<booktitle>
Algebraic Methods in Operator Theory
</booktitle>
<year>
1994
</year>
<editor>
R. Curto and P. E. T. Jørgensen
</editor>
<publisher>
Birkhäuser, Boston - Basel - Berlin
</publisher>
<note>
307-315
</note>
</inproceedings>
...
a lot of more elements
...
</bibliography>
还有我的 XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<title>Bibliographie</title>
<style type="text/css">
.entry {
font-family: Georgia
}
.entry italic {
font-style: italic
}
</style>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="/bibliography/*">
<p>
<div class="entry{@type}">
[<xsl:number count="*"/>]
<xsl:apply-templates/>
</div>
</p>
</xsl:template>
</xsl:stylesheet>
我在这些文件中遗漏了什么吗?
【问题讨论】:
-
您是通过 HTTP 还是从文件系统加载 XML 文档?您是否检查了错误控制台是否显示一些安全问题或其他指示可能是什么问题?
-
控制台显示:
Unsafe attempt to load URL file:///D:/Dropbox/path/bibliography.xsl from frame with URL file:///D:/Dropbox/path/bibliography-with-xsd.xml. Domains, protocols and ports must match. -
听起来您的安全设置不允许从本地文件系统执行 XSLT。不知道如何改变这一点。
-
所以您正在尝试从文件系统加载文件。我认为最新版本的 Opera 是基于 Google Chrome 的,并且不允许从文件系统加载 XML 并应用 XSLT,除非您以较低的安全设置启动 Chrome。我不知道
标签: xml internet-explorer firefox xslt opera