我有一个xml文档,我正在使用XSLT创建一个手风琴。如果文件夹有子节点,xslt / xml应该只创建一个h3的手风琴。同时,我需要手风琴来生成单页链接。我怎么能做到这一点?排序确实很重要,所以我无法移动手风琴div之外的单页链接....
我与谷歌的单页链接打破了手风琴。我想保留所有元素h3s。有没有办法让手风琴忽略没有div兄弟的h3?
<div id="accordion">
<h3>Section 1</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3>Section 2</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="google.html">Single Page Link to Google</a></h3>
<h3>Section 3</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
</div>
答案 0 :(得分:0)
Google链接后的ul标记没有开头“&lt;”。 a也缺少结束标记,使得所有跟随实时链接的内容都是google。我也把它扔在像这样的html结构中,似乎对我有用。
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="accordion">
<h3>Section 1</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3>Section 2</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="google.html">Single Page Link to Google</a></h3>
<h3>Section 3</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
</div>
</body>
</html>
答案 1 :(得分:0)
对于未来的stackoverflowers,我只是用一个标题类来定位手风琴代码。
<script>
$(function() {
$("h3").siblings(".banner").not(".active").hide();
$( "#accordion" ).accordion( { header: 'h3.folder', collapsible: true});
});
</script>
</head>
<body>
<div id="accordion">
<h3 class="folder">Section 1</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3 class="folder">Section 2</h3>
<div>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="google.html">Single Page Link to Google</a></h3>
<h3 class="folder">Section 3</h3>
<div>
ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
</div>