XML & XSLT -> XML

T

Tony

Can anyone help, can't seem to completely sus this xslt out.
<Navigation>
<Item name="Home" depth="1" navid="1" type="16">
<Item name="Consumers" depth="2" navid="2" type="128">
<Item name="Products" depth="3" navid="3" type="64">
<Item name="Products 1a" depth="4" navid="4" type="16"/>
<Item name="Products 1b" depth="4" navid="5" type="16">
<Item name="1b1" depth="5" navid="6" type="16"/>
<Item name="1b2" depth="5" navid="7" type="16"/>
</Item>
<Item name="Products 1c" depth="4" navid="8" type="16"/>
<Item name="Products 1d" depth="4" navid="9" type="16">
<Item name="1d1" depth="5" navid="10" type="16"/>
<Item name="1d2" depth="5" navid="11" type="16"/>
</Item>
<Item name="Products 1e" depth="4" navid="12" type="16"/>
</Item>
</Item>
<Item name="Non-Consumers" depth="2" navid="125" type="128">
<Item name="Services" depth="3" navid="126" type="64">
<Item name="Service 1" depth="4" navid="127" type="16">
<Item name="Service 1a" depth="5" navid="128" type="16"/>
<Item name="Service 1b" depth="5" navid="129" type="16"/>
</Item>
<Item name="Service 2" depth="4" navid="130" type="16">
<Item name="Service 2a" depth="5" navid="131" type="16"/>
<Item name="Service 2b" depth="5" navid="132" type="16"/>
<Item name="Service 2c" depth="5" navid="133" type="16"/>
<Item name="Service 2d" depth="5" navid="134" type="16"/>
</Item>
</Item>
</Item>
</Item>
</Navigation>

to something like

<h1>Consumer</h1>
<h2>Products</h2>
<ul>
<li>Products 1a</li>
<li>Products 1b
<ul>
<li>1b1</li>
<li>1b2</li>
</ul>
</li>
<li>Products 1c</li>
<li>Item 4</li>
<li>Products 1d
<ul>
<li>1d1</li>
<li>1d2</li>
</ul>
</li>
</ul>

obviously I'd need to pass in a starting point i.e. NavID = 2 or 125

Can anyone help, I seem to be going around in circles.

Thanks

Tony
 
S

Sebastian Kerekes

Tony said:
Can anyone help, I seem to be going around in circles.

As far as I understood you want to transform the upper XML code to the
lower XML/HTML(?) code. Well, you can to that with XSLT. I won't solve
it for you, but you can do it easily yourself. Have a look at some
online tutorials, e.g. www.w3schools.com shows the basics, but that
should be enough for this. Also have a look at XPath - it's used with XSLT.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top