QtWebKit 不显示 css/xsl

发布于 2024-10-30 14:14:26 字数 1683 浏览 6 评论 0原文

我无法让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文