I pulled this information from an MySQL table and formatted it into and xML markup
Code: Select all
<?xml version="1.0" ?>
- <menus>
- <section name="about">
<menu id="4000" name="About Us" link="index.php/about/" contentid="" parentid="0" order="1" />
<menu id="4001" name="Who We Are" link="index.php/about/4001" contentid="" parentid="4000" order="1" />
<menu id="4002" name="Strategic Partners" link="index.php/about/4002" contentid="" parentid="4000" order="2" />
<menu id="4003" name="Contact Us" link="index.php/about/4003" contentid="" parentid="4000" order="3" />
</section>
- <section name="services">
<menu id="7000" name="Services" link="index.php/services" contentid="" parentid="0" order="2" />
<menu id="71041" name="Graphic Design" link="none" contentid="" parentid="7000" order="1" />
<menu id="96411" name="Print" link="none" contentid="" parentid="71041" order="1" />
<menu id="41213" name="Press" link="none" contentid="" parentid="96411" order="2" />
<menu id="14119" name="Call Cards" link="none" contentid="" parentid="96411" order="1" />
<menu id="44316" name="Web Development" link="none" contentid="" parentid="7000" order="2" />
<menu id="16175" name="Internet Programming" link="none" contentid="" parentid="44316" order="1" />
<menu id="71416" name="PHP" link="none" contentid="" parentid="16175" order="1" />
<menu id="37341" name="MySQL" link="none" contentid="" parentid="16175" order="2" />
<menu id="94633" name="Flash Development" link="none" contentid="" parentid="44316" order="1" />
</section>
- <section name="success">
<menu id="43981" name="Client Success" link="index.php/success/F2C3E0/43981" contentid="F2C3E0" parentid="0" order="3" />
</section>
</menus>Code: Select all
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="menus">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>Untitled Document</title>
<script language="javascript" src="/cms/includes/cms.js" type="text/javascript"></script>
<link href="/cms/includes/cms_css.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<table width="100%" border="0">
<tr>
<th align="center" valign="middle" nowrap="nowrap">Menu Item ID</th>
<th align="center" valign="middle" nowrap="nowrap">Menu Item Name</th>
<!--<th align="center" valign="middle" nowrap="nowrap">Menu Link</th>-->
<th align="center" valign="middle" nowrap="nowrap">Section</th>
</tr>
<!-- list menus -->
<xsl:apply-templates select="section" />
</table>
</body>
</html>
</xsl:template>
<xsl:template name="section" match="section">
<xsl:apply-templates select="menu">
<xsl:param name="parent" select="@id"/>
<xsl:sort select="@parentid" data-type="number" order="ascending"/>
<xsl:sort select="@order" data-type="number" order="ascending"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="menu" match="menu">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="../@name"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>any advise on a better strategy is greatly appreciated
Kendall