在XSL中添加单选输入以显示XML元素 [英] Add radio input in a XSL to display XML elements
本文介绍了在XSL中添加单选输入以显示XML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果选中了xsl <form>
中的单选按钮,我想显示<tags>
和<text>
.
I would like to display <tags>
and <text>
if radios buttons located in the xsl <form>
are checked.
这是我的 xml :
<global>
<informations>
<title>document 1</title>
<text>This is text of doc 1</text>
<tags>tag01</tags>
</informations>
<informations>
<title>document 2</title>
<text>This is text of doc 2</text>
<tags>tag02</tags>
</informations>
</global>
这是我的 xsl (使用HTML输出方法):
And here my xsl (with an HTML output method) :
<xsl:template match="/">
<form><input type="radio">here</input><input type="radio">and here !</input></form>
<xsl:for-each select="//informations">
<div>
<h2><xsl:value-of select="title"/></h2>
<p><xsl:value-of select="text"/></p>
<tag><xsl:value-of select="tags"/></tag>
</div>
</xsl:template>
感谢您的帮助!
推荐答案
更改
<p><xsl:value-of select="text"/></p>
收件人
<p class="hideableText"><xsl:value-of select="text"/></p>
更改
<tag><xsl:value-of select="tags"/></tag>
收件人
<span class="hideableTags"><tag><xsl:value-of select="tags"/></tag></span>
您的复选框onClick必须检查复选框的状态&隐藏或显示元素.
Your checkbox onClick must check the state of checkBox & hide or show the element.
示例(使用jQuery):
Example (Using jQuery):
$('p.hideableText').hide();
$('p.hideableText').show();
这篇关于在XSL中添加单选输入以显示XML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文