1
我遇到了一個問題,我的XML沒有正確顯示。基本上,我有一個充滿鏈接的XML文檔,我希望XSL樣式表在有序列表中輸出XML。到目前爲止,一切工作正常,樣式是正確的,但沒有數據顯示的鏈接。你只是看到了風格化的背景。我將XML正確地連接到XSL,並且Dreamweaver毫無問題地驗證了XML代碼。不知道我在這裏錯過了什麼?XML不能用XSL樣式表顯示
的test.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="teststyle.xsl"?>
<country xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<au>
<open><li><a href="/contest/test/goto.php?id=0" target="_blank"></open>
<description>Win a Macbook!</description>
<close></a></li></close>
</au>
<au>
<open><li><a href="/contest/test/goto.php?id=1" target="_blank"></open>
<description>Win a trip to Las Vegas!</description>
<close></a></li></close>
</au>
</country>
teststyle.xsl
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="test.xml" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Untitled Document</title>
</head>
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="country/au">
<div style="background-color:teal;color:white;padding:4px">
<ol>
<span style="font-weight:bold"><xsl:value-of select="country/au/open" /><xsl:value-of select="country/au/description"/><xsl:value-of select="country/au/close"/></span>
</ol>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
哇, 謝謝!我今天剛開始學習XML/XSL,所以我仍然在學習繩索。 – RayMicro 2011-04-29 05:40:55
+1最後回答阻礙DOE機制。 – 2011-04-29 13:39:29