我有一个问题,我认为应该很容易解决,但我似乎找不到解决方案。我有一个要显示的 xml 文件。为此,我目前正在使用 XSLT 文件来执行此操作。现在,我只是将我的 CSS 从嵌入到 XSLT 中更改为一个 CSS 文件,这样更好,因为我将能够对多个 XSLT 文件使用相同的 CSS 文件。
这是我的 XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tools="tools">
<xsl:include href="AnotherXSLT.xsl" />
<xsl:template match="/">
<html>
<head>
<link href="styles.css" rel="stylesheet" type="text/css" MEDIA="screen" >
</head>
<body>
...
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我的意思是,它作为样式表再简单不过了。但是当它被处理时,Internet Explorer 给我这个错误:
End tag 'head' does not match the start tag 'link'. Error processing resource
'file:///C:/Users/...
</head>
--------^
我试过这样关闭链接标签:
<link href="styles.css" rel="stylesheet" type="text/css" MEDIA="screen" />
然后我简单地得到:结束标记“html”与开始标记“LINK”不匹配。
我还尝试在 <html>
之前添加 DOCTYPE标签内,我收到另一个错误,说我不能在 proclog 或其他东西之后放置文档类型。
有什么想法吗?
根据要求,这是我的 CSS:
body
{
font-family:"Courier New", Courier, monospace;
字体大小:0.8em;
表.mono
{
font-family:"Courier New", Courier, monospace;
字体大小:0.85em;
边框折叠:折叠;
table.solidblack, th.solidblack, td.solidblack
{
边框:1px 纯黑色;
跨度
{
字体大小:继承;
显示:内联 block ;
padding-left:16px;
td.padding, th.padding
{
padding-left:16px;
padding-right:16px;
h3.exp
{
显示:内联;
padding-left:6px;
}
最佳答案
我们需要查看您的 CSS 周围的线条。谢谢。
编辑:顺便说一下,无论有没有你的 XSLT,我都可以假设你忘记了你的最后一个尾部斜线:
<link rel="stylesheet" href="../css/style.css" type="text/css" />
最后看“/”。
关于html - 在 Internet Explorer 中使用 XSLT 和 CSS 处理 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4161392/