我想在下拉列表中显示带有所选月份值的表格,首先我隐藏了表格,用javascript中的一个函数显示表格,现在我不知道如何只显示与本月相关的信息. 可以在 xsl 代码中使用 if 语句吗?谢谢。
书籍.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="tabla.xsl"?>
<TotalBooks>
<books month= "January">
<book>
<isbn> 1 </isbn>
<tittle>The tittle</tittleo>
<author>Me</author>
</book>
<book>
<isbn> 2 </isbn>
<tittle>The tittle two</tittleo>
<author>Me</author>
</book>
</books>
</TotalBooks>
书籍.xsl
<html>
<head>
<script>
function TryOption()
{
tabla.style.visibility="visible";
}
</script>
</head>
<body>
<h1>My books</h1>
<div>
<label> Sales/ month: </label>
<select>
<option> </option>
<xsl:for-each select="TotalBooks/books">
<option onclick="TryOption();">
<xsl:value-of select="@month"/>
</option>
</xsl:for-each>
</select>
</div>
<div>
<table id="tabla">
<tr bgcolor="skyblue">
<th align="left">Tittle</th>
<th align="left">Author</th>
</tr>
<xsl:for-each select="TotalBooks/books/book">
<tr>
<td>
<xsl:value-of select="tittle"/>
</td>
<td>
<xsl:value-of select="author"/>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</body>
</html>