QtWebKit 不显示 css/xsl
我无法让 qtwebkit 显示 css/xsl。我已经尝试过这两种方法,它们可以在网络浏览器中工作,但不能在 qtwebkit 中工作。是否需要启用某个设置才能应用样式表,或者这是 qtwebkit 的失败?
编辑:Qt 4.7 中禁用了 XSLT 支持 (http://gitorious.org/webkit/qtwebkit/commit/8961d12)
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="status.xsl"?>
<hk>
<item><name>Some Parameter</name><value>value</value></item>
<item><name>Test Count</name><value>38</value></item>
</hk>
xsl (status.xsl)
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*|/">
<html><head>
<meta http-equiv="refresh" content="1"></meta></head>
<body> <h2>Status</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Parameter</th>
<th>Value</th>
</tr>
<xsl:for-each select="hk/item"> <tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="value"/></td>
</tr> </xsl:for-each> </table>
</body> </html> </xsl:template> </xsl:stylesheet>
QtWebKit
webView->settings()->setUserStyleSheetUrl(QUrl::fromLocalFile("file.css"));
webView->load(QUrl("http://192.x.x.x:port/file.xml));
查看时浏览器中的 URL CSS 看起来不错...但在 webkit 中却不行?
I cannot get qtwebkit to display css/xsl. I have tried both and they work in web browsers, but not in the qtwebkit. Is there a setting I need to enable to apply a stylesheet, or is this a downfall of the qtwebkit?
EDIT: XSLT support is disabled in Qt 4.7 (http://gitorious.org/webkit/qtwebkit/commit/8961d12)
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="status.xsl"?>
<hk>
<item><name>Some Parameter</name><value>value</value></item>
<item><name>Test Count</name><value>38</value></item>
</hk>
xsl (status.xsl)
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*|/">
<html><head>
<meta http-equiv="refresh" content="1"></meta></head>
<body> <h2>Status</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Parameter</th>
<th>Value</th>
</tr>
<xsl:for-each select="hk/item"> <tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="value"/></td>
</tr> </xsl:for-each> </table>
</body> </html> </xsl:template> </xsl:stylesheet>
QtWebKit
webView->settings()->setUserStyleSheetUrl(QUrl::fromLocalFile("file.css"));
webView->load(QUrl("http://192.x.x.x:port/file.xml));
When viewing the URL in a browser the css looks fine... but not in webkit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论