Jump to content

Navigation


xmlxpert
 Share

Recommended Posts

What do you mean by "navigation page"? A site map? Well, it's quite simple actually. Just have your menu data in some XML, transform it with some kind of XSLT and use ASP to execute that transformation. Example:xml

<?xml version="1.0" encoding="utf-8"?><menu>	<item>  <title>Home</title>  <link>#</link>	</item>	<item>  <title>About us</title>  <link>#</link>	</item>	<item>  <title>News</title>  <link>#</link>	</item>	<item>  <title>Links</title>  <link>#</link>	</item>	<item>  <title>Images ></title>  <link>#</link>  <menu>  	<item>    <title>Photos</title>    <link>#</link>  	</item>  	<item>    <title>Wallpapers</title>    <link>#</link>  	</item>  </menu>	</item></menu>

XSLT

<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="navigation.xml" --><!DOCTYPE xsl:stylesheet  [	<!ENTITY nbsp   " ">	<!ENTITY copy   "©">	<!ENTITY reg    "®">	<!ENTITY trade  "™">	<!ENTITY mdash  "—">	<!ENTITY ldquo  "“">	<!ENTITY rdquo  "”"> 	<!ENTITY pound  "£">	<!ENTITY yen    "¥">	<!ENTITY euro   "€">]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" encoding="utf-8"/><xsl:template match="menu"><xsl:variable name="link" select="link" /><ul class="menu"><xsl:for-each select="item">	<li class="navlink">  <xsl:choose>  	<xsl:when test="menu">    <a class="hide" href="{$link}"><xsl:value-of select="title" /></a>    <xsl:apply-templates select="menu"/>  	</xsl:when>  	<xsl:otherwise>    <a class="navlink" href="{$link}"><xsl:value-of select="title" /></a>	  	</xsl:otherwise>  </xsl:choose>	</li></xsl:for-each></ul></xsl:template></xsl:stylesheet>

And the ASP from XSLT on the server example.With some CSS, the above could also be a menu (as it's root node implies). Infact, this is the XSLT of the first CSS only menu from cssplay. I'm having some difficulties getting the conditional comments for IE properly, but I'll do it soon hopefully.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...