xslt スタイル シートで行を非表示にする方法を見つけようとしています。使用可能なすべての行を表示する XSLT スタイル シートを作成しましたが、xml が読み込まれると一部の行が非表示になるようにしたいと考えています。
これが xslt (xml スタイル シート) の外観です。
<?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="/Catalogue">
<html>
<body>
<xsl:for-each select="Tales">
<xsl:if test="Talent != ''">
<table border="0" width="550">
<tr>
<td bgcolor="#A0A0A0" width="80%"><b><xsl:value-of select="Tale"/></b></td>
<td bgcolor="#A0A0A0" width="20%" align="center"><xsl:value-of select="Cost"/>
<xsl:text> - </xsl:text>
<xsl:value-of select="Type"/></td>
</tr>
<tr>
<xsl:if test="Prereq != ''">
<td colspan="2" bgcolor="#C0C0C0"><xsl:value-of select="Prereq"/></td>
</xsl:if>
</tr>
<tr>
<xsl:if test="Action != ''">
<td colspan="2" bgcolor="#E0E0E0"><xsl:value-of select="Action"/></td>
</xsl:if>
</tr>
<tr>
<xsl:if test="Description != ''">
<td colspan="2" bgcolor="#EBEBEB"><xsl:value-of select="Description"/></td>
</xsl:if>
</tr>
</table>
<br/> <br/>
</xsl:if>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
ページが開いたときにPrereq、Action、および説明を保持するテーブルの行を非表示にする方法を知りたいのですが、ボタンまたは+リンクを押してそれらの行を表示します..再度クリックすると非表示になります。
javascript で行われていることを示すチュートリアルを見たことがありますが、このコードを追加しようとするとすぐに xml データが表示されなくなります。
どんな助けでも大歓迎です。
更新:これはxmlがどのように見えるかです
<?xml version="1.0"?>
<?xml-stylesheet href="bloodandguts.xsl" type="text/xsl"?>
<Catalogue>
<Tales>
<Talent>Training</Talent>
<Cost>1</Cost>
<Type>Any</Type>
<Prereq></Prereq>
<Action>Passive</Action>
<Description>Confers proficiency of a single type of training</Description>
</Tales>
// then lots more <Tales></Tales>
</Catalogue>
アップデート:
これが私のxsltに追加する方法です...しかし、何らかの理由で、xmlファイルが何も表示されなくなります
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<script type ="text/javascript" src="jquery.js" ></script>
<xsl:template match="/Catalogue">
<html>
<body>