[英]XML and XSL don't display as I hope
我有一個名為“ Spider-Man.xml”的文件:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Spider-Man.xsl"?>
<movie>
<title>Spider-Man</title>
<year>2002</year>
<genre>action</genre>
</movie>
並命名為“ Spider-Man.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>
<body>
<h1>Information on a film</h1>
<table>
<tr>
<td>Title</td>
<td> <xsl:value-of select="/movie/title"/> </td>
</tr>
<tr>
<td>Year</td>
<td> <xsl:value-of select="/movie/year"/> </td>
</tr>
<tr>
<td>Genre</td>
<td> <xsl:value-of select="/movie/genre"/> </td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
當我打開Spider-Man.xml時,所有內容都顯示為唯一文本(因此,沒有<h1>
,沒有<table>
)。 但是,如果我進入控制台,我會看到要顯示的代碼。
為什么顯示不好? 提前致謝
設置邊框,例如<table border="1">
,您將看到表格的布局。
t1
似乎顯示出預期的效果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.