Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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):

XML
<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
Posted
Updated 16-Dec-10 20:31pm
v2
Comments
JF2015 17-Dec-10 2:31am    
Edited to fix links and remove email address. Please never post your email address. You will be notified if someone answers your post.

1 solution

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 simply select="link" to render the LI elements.)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900