Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xml文件的xsl样式表在浏览器上不可见_Xml_Xslt - Fatal编程技术网

xml文件的xsl样式表在浏览器上不可见

xml文件的xsl样式表在浏览器上不可见,xml,xslt,Xml,Xslt,在看到许多类似的问题后,我能够解决看到的错误,现在内容可以在浏览器上看到。但我看不到样式表的使用,也看不到未观察到的样式,它只是显示为纯文本。请帮忙 [xml文件=content.xml] <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet content-type="text/xsl" href="xslcontent.xsl"?> <catalog> <cd> <title>

在看到许多类似的问题后,我能够解决看到的错误,现在内容可以在浏览器上看到。但我看不到样式表的使用,也看不到未观察到的样式,它只是显示为纯文本。请帮忙

[xml文件=content.xml]

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet content-type="text/xsl" href="xslcontent.xsl"?>
<catalog>
<cd>
<title>Ram Sailee</title>
<artist>Bipul Chhetri</artist>
<country>Nepal</country>
<company>Songs Nepal</company>
<price>300</price>
<year>2014</year>
</cd>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
</catalog>
<xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>

<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th style="text-align:left" >Title</th>
<th style="text-align:left" >Artist</th>
</tr>

<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>


</xsl:for-each>
</table>
</body>

</html>
</xsl:template>
</xsl:stylesheet>

拉姆·塞利

尝试在XML中更改此部分:

<?xml-stylesheet content-type="text/xsl" href="xslcontent.xsl"?>

致:



这是XSLT文件的精确副本吗?XML声明中缺少一个
:它应该是
,而不是
@michael.hor257k:是的,它是精确的副本。我纠正了错误,仍然是一样的。它是哪个浏览器?它的谷歌浏览器,但我也检查了Mozilla Firefox。如果我将其更改为,则所有内容都会消失,看到空白页。是的,它现在在Firefox中工作,非常感谢。现在,我将尝试更多。但是,不在chrome中工作的原因可能是什么。chrome中存在安全问题-执行搜索。您是在文件存储中还是在HTTP服务器中运行此操作?有些浏览器使在文件存储中执行此类操作变得困难或不可能。您可以调整安全设置,但创建本地web服务器通常更容易。
<?xml-stylesheet type="text/xsl" href="xslcontent.xsl"?>