<rs:data ItemCount="6">
<z:row ows_Question='How do email notifications work?'
ows_Topic='Email Notifications' ows_Answer='An alert email is sent out.'/>
<z:row ows_Question='How secured are passwords?'
ows_Topic='Passwords' ows_Answer='Passwords are very secured'/>
<z:row ows_Question='How do we create strong passwords?'
ows_Topic='Passwords' ows_Answer='Combine alphanumerics with symbols.' />
<z:row ows_Question='What are disadvantages of phones?'
ows_Topic='Phones' ows_Answer='Probably very few, if none.'/>
<z:row ows_Question='What models do you like?'
ows_Topic='Phones' ows_Answer='Smartphones, with touch interface.'/>
<z:row ows_Question='How often do email notifications occur?'
ows_Topic='Email Notifications' ows_Answer='Five times a day.' />
</rs:data>
我正在尝试根据主题对问题进行分组并生成如下所示的标记,但我无法完全理解它,因为即使生成的 xml 很简单,但需要创建的所需 html 标记也非常复杂。我正在尝试为带有组标题的常见问题创建嵌套手风琴,就像这里一样:http: //www.adipalaz.com/experiments/jquery/nested_accordion_demo3.html
任何人都可以帮我使用 jQuery 格式化标记吗?
<div id="main">
<ul class="accordion" id="faq">
<li>
<h4>Email Notifications</h4> <!--Topic -->
<div class="inner">
<ul>
<li>
<h5>How do email notifications work?</h5>
<div class="inner shown">
<p>An alert email is sent out.</p>
</div>
</li>
<li>
<h5>How often do email notifications occur?</h5>
<div class="inner">
<p>Five times a day.</p>
</div>
</li>
</ul>
</div>
</li>
<li>
<h4>Passwords</h4> <!--topic as group header -->
<div class="inner">
<ul>
<li>
<h5>How secured are passwords?</h5>
<div class="inner shown">
<p>Passwords are very secured.</p>
</div>
</li>
<li>
<h5>How do we create strong passwords?</h5>
<div class="inner">
<p>Combine alphanumerics with symbols.</p>
</div>
</li>
</ul>
</div>
</li>