jQuery手风琴/Xsl [英] Jquery Accordion/Xsl
问题描述
所以,这就是我在做什么:
我正在用xsl转换来自xml的链接列表.借助这些转换后的数据,我将其制作成一个jQuery手风琴列表.
让我们从代码开始:
Xml(示例不实际):
< 链接 > ;
< topic =" 一个" < 链接 >
< 标题 >
1个
< /title >
< url >
http://blahblah.com
< url >
< /link >
< /url > < /url >
< /topic >
< 链接 >
但可以说主题id = one
拥有三个标题(1,2,3)
和主题id = two
有三个标题
您将如何编码xsl,以便最终将其转换为手风琴列表?
抱歉,我不知道如何复制代码?
当我使用上面的代码时,手风琴列表最终被
一个
1
4
两个
1
4
代替:
一个
1
2
3
两个
4
5
6
我在Google文档中有我的xsl和xml文件,请随时查看
https://docs.google.com/leaf?id=0B4bIPmgE94uPZjkxNjUyMzQtMzMyNy00Y2U3LWI1MDAtNzcwODY2ZWU2NzE1&hl=en
https://docs.google.com/leaf?id=0B4bIPmgE94
有什么想法吗??
在此先感谢
:confused:〜布列塔尼·安斯特亚特(Brittany Ansteatt)〜:confused:
*已删除邮件*
任何输入将不胜感激
您可能需要仔细查看xml源.该示例在单个主题/链接中具有同级的title和url元素.我认为,如果添加一些其他<link>....</link>
元素来包装<title></title><url></url>
对,则xslt将会按预期工作.
(也请注意,在<xsl:for-each select="/links/topic">
的上下文中,无需重复xpath的该部分;您只需select="link"
即可呈现LI元素.)
>
So, here is what I am doing:
I am transforming a list of links from an xml with an xsl. With that transformed data I am making it into a jquery accordion list.
Lets start with the code:
Xml (Example not actual):
<links>
<topic id="one">
<link>
<title>
1
</title>
<url>
http://blahblah.com
<url>
</link>
</url></url>
</topic>
<links>
But lets say that topic id=one
has three titles (1,2,3)
and topic id=two
has three titles
How would you code the xsl so that it could end up being transformed as an accordion list?
Sorry I do''nt know how to copy in code?
When I use the above code the accordion list end up being
One
1
4
Two
1
4
Instead of:
One
1
2
3
Two
4
5
6
I have my xsl and xml files on google docs, feel free to take a look
https://docs.google.com/leaf?id=0B4bIPmgE94uPZjkxNjUyMzQtMzMyNy00Y2U3LWI1MDAtNzcwODY2ZWU2NzE1&hl=en
https://docs.google.com/leaf?id=0B4bIPmgE94uPNWY5MGE3ZTEtOTk0Zi00MDczLTk4OTEtZmRmNWIzNjM4NGM0&hl=en
Any ideas????
Thanks in advance
:confused:~Brittany Ansteatt~:confused:
*REMOVED MAIL*
Any input would be greatly appreciated
You may need to take a closer look at your xml source. The sample has a run of title and url elements as siblings within a single topic/link. I think your xslt will work as you expect if you add some additional<link>....</link>
elements to wrap the<title></title><url></url>
pairs.
(Note too that within the context of the<xsl:for-each select="/links/topic">
, there''s no need to repeat that portion of the xpath; you can simplyselect="link"
to render the LI elements.)
这篇关于jQuery手风琴/Xsl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!