XML Menu

I’ve changed the structure of an XML doc from this type of layout:


<clientlist>
<item industry="infocom" country="us">
<client>3Com / Marlborough, MA</client>
<URL>http://www.3com.com</URL>
</item>
<item industry="retail" country="us">
<client>Ahold usA Inc / Chantilly, VA</client>
<URL>http://www.ahold.com</URL>
</item>
<item industry="nonprofit" country="us">
<client>AIGA / New York, NY</client>
<URL>http://www.aiga.com</URL>
</item>
</clientlist>

to this layout style where the individual items are placed within a category node:


<clientlist>
        <autoaero>
          <item industry="autoaero" country="canada">
            <client>Avcorp / Delta, BC</client>
            <URL>http://www.avcorp.com</URL>
          </item>
        </autoaero>
        <business>
          <item industry="business" country="canada">
            <client>Albert Normandin Photography / Vancouver, BC</client>
            <URL>http://www.albertnormandin.com</URL>
          </item>
        </business>
</clientlist>

The trouble I’m having with the code is that I’m unable to loop through the different categories: autoaero, business, consumer, education, etc. No matter which menu category I feed into the function I only get the firstChild nodeValue (“autoaero”) data. I’m attaching an example of version #1 which behaves correctly and version 2 which only outputs the first category node. I’d really appreciate someone else looking at this code - it may be something obvious and I’m just too burnt to notice it.