Displaying Generic Stylesheet

kevp75
kevp75 used Ask the Experts™
on
How can I display the attached XML file in a nested UL format using XSLT?

So it looks like:

Home
About
    Resume
    Portfolio
        Sites...

<SiteMap site="www.07th.com">
<Pages><Page><pageID>198</pageID><pageTitle>Welcome To o7th Web Design</pageTitle><pageLink>Home</pageLink></Page><Page><pageID>216</pageID><pageTitle>About o7th Web Design</pageTitle><pageLink>About</pageLink><SubPages><SubPage><pageID>220</pageID><pageTitle>Kevin C. Pirnie - Resume</pageTitle><pageLink>Kevin's Resume</pageLink></SubPage><SubPage><pageID>227</pageID><pageTitle>o7th Web Design's Portfolio</pageTitle><pageLink>Our Portfolio</pageLink><SubPages><SubPage><pageID>228</pageID><pageTitle>Internet Services Inc.</pageTitle><pageLink>Internet Services Inc.</pageLink></SubPage><SubPage><pageID>229</pageID><pageTitle>Best Darn Barn</pageTitle><pageLink>Best Darn Barn</pageLink></SubPage><SubPage><pageID>230</pageID><pageTitle>Zip Content Management</pageTitle><pageLink>Zip Content Management</pageLink></SubPage><SubPage><pageID>231</pageID><pageTitle>A Pen Lovers Paradise</pageTitle><pageLink>A Pen Lovers Paradise</pageLink></SubPage><SubPage><pageID>232</pageID><pageTitle>JMB Financial Managers</pageTitle><pageLink>JMB Financial Managers</pageLink></SubPage><SubPage><pageID>233</pageID><pageTitle>Crowne Plaza - Dayton</pageTitle><pageLink>Crowne Plaza - Dayton</pageLink></SubPage><SubPage><pageID>234</pageID><pageTitle>Stage Stop Motel</pageTitle><pageLink>Stage Stop Motel</pageLink></SubPage><SubPage><pageID>235</pageID><pageTitle>KC Customs</pageTitle><pageLink>KC Customs</pageLink></SubPage><SubPage><pageID>236</pageID><pageTitle>Vietnam Battlefield Tours</pageTitle><pageLink>Vietnam Battlefield Tours</pageLink></SubPage><SubPage><pageID>237</pageID><pageTitle>ZipCM - Management Site</pageTitle><pageLink>ZipCM - Management Site</pageLink></SubPage><SubPage><pageID>238</pageID><pageTitle>ESR Support</pageTitle><pageLink>ESR Support</pageLink></SubPage><SubPage><pageID>239</pageID><pageTitle>Showket Vineyards Emailer</pageTitle><pageLink>Showket Vineyards Emailer</pageLink></SubPage><SubPage><pageID>240</pageID><pageTitle>Novato High Alumni</pageTitle><pageLink>Novato High Alumni</pageLink></SubPage><SubPage><pageID>241</pageID><pageTitle>VIP Trucks</pageTitle><pageLink>VIP Trucks</pageLink></SubPage><SubPage><pageID>242</pageID><pageTitle>Ink Fanatic</pageTitle><pageLink>Ink Fanatic</pageLink></SubPage><SubPage><pageID>243</pageID><pageTitle>Our Tiny Family</pageTitle><pageLink>Our Tiny Family</pageLink></SubPage><SubPage><pageID>244</pageID><pageTitle>Rock n Blues By The Lake</pageTitle><pageLink>Rock n Blues By The Lake</pageLink></SubPage><SubPage><pageID>245</pageID><pageTitle>EPlan LLC</pageTitle><pageLink>EPlan LLC</pageLink></SubPage></SubPages></SubPage></SubPages></Page><Page><pageID>217</pageID><pageTitle>Our Privacy Policy</pageTitle><pageLink>Privacy</pageLink></Page><Page><pageID>218</pageID><pageTitle>Contacting o7th Web Design</pageTitle><pageLink>Contact Us</pageLink></Page><Page><pageID>219</pageID><pageTitle>Services Provided</pageTitle><pageLink>Services</pageLink></Page><Page><pageID>226</pageID><pageTitle>o7th Web Design Sitemap</pageTitle><pageLink>Sitemap</pageLink></Page><Page><pageID>253</pageID><pageTitle>Login</pageTitle><pageLink>Login</pageLink></Page></Pages>

    </SiteMap>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Information Architect
Top Expert 2006
Commented:
I suspect something like this will do
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    
    <xsl:output indent="yes"/>
    <xsl:template match="Pages">
        <html>
            <body>
                <ul>
                    <xsl:apply-templates select="Page"/>
                </ul>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="SubPages">
        <ul>
            <xsl:apply-templates select="SubPage"/>
        </ul>
    </xsl:template>
    
    <xsl:template match="Page | SubPage">
        <li><xsl:value-of select="pageLink"/></li>
        <xsl:apply-templates select="SubPages"/>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

Author

Commented:
thanks.  roughly does what I am looking to do
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
welcome

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial