【发布时间】:2012-01-20 12:45:00
【问题描述】:
我有一个 .xml 文件,其中附带一个 .xsl 文件。其输出可以是found here。
我正在尝试创建一个 html 网页,用户可以在其中输入搜索框,例如 'Year < 2009'。它将显示上面找到的表格,但仅显示年份小于 2009 年。
我真的不知道从哪里开始,或者我需要研究什么来创建这个功能。
作为参考,这里有一个 XML sn-p:
<?xml-stylesheet type="text/xsl" href="podcatalog.xsl"?>
<pods-papers>
<inproceedings key="AbbadiSC85">
<crossref>conf/pods/85</crossref>
<author>Amr El Abbadi</author>,
<author>Dale Skeen</author>,
<author>Flaviu Cristian</author>,
<title>An Efficient, Fault-Tolerant Protocol for Replicated Data Management.</title>,
<pages>215-229</pages>,
<year>1985</year>,
<booktitle>PODS</booktitle>,
</inproceedings>
<inproceedings key="AbbadiT86">
<crossref>conf/pods/86</crossref>
<author>Amr El Abbadi</author>,
<author>Sam Toueg</author>,
<title>Availability in Partitioned Replicated Databases.</title>,
<pages>240-251</pages>,
<year>1986</year>,
<booktitle>PODS</booktitle>,
</inproceedings>
<inproceedings key="Abdel-GhaffarA90">
<crossref>conf/pods/90</crossref>
<author>Khaled A. S. Abdel-Ghaffar</author>,
<author>Amr El Abbadi</author>,
<title>On the Optimality of Disk Allocation for Cartesian Product Files.</title>,
<pages>258-264</pages>,
<year>1990</year>,
<booktitle>PODS</booktitle>,
</inproceedings>
<inproceedings key="Abiteboul83">
<crossref>conf/pods/83</crossref>
<author>Serge Abiteboul</author>,
<title>Disaggregations in Databases.</title>,
<pages>384-388</pages>,
<year>1983</year>,
<booktitle>PODS</booktitle>,
</inproceedings>
</pods-papers>
这里是 XSLT ("podcatalog.xsl"):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Pods Papers</h2>
<table border="1">
<tr bgcolor="#9ACD32">
<th>Author</th>
<th>Title</th>
<th>Pages</th>
<th>Year</th>
</tr>
<xsl:for-each select="pods-papers/inproceedings">
<xsl:sort select="author"/>
<tr>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="pages"/></td>
<td><xsl:value-of select="year"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
请注意:我不一定是在寻找代码,或者要写什么,而是,例如,一个向我展示如何实现全部或部分代码的网页
【问题讨论】:
-
我已添加您的 XML/XLT 以供将来参考。毕竟,您链接到的那个页面可能不会永远存在。
标签: javascript html xml xslt filtering