Login   Register  
PHP Classes
elePHPant
Icontem

File: rsd.xsl

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Luis I. Larrateguy  >  XML Menu  >  rsd.xsl  >  Download  
File: rsd.xsl
Role: Auxiliary data
Content type: text/plain
Description: the menu presentation
Class: XML Menu
Generate hierarchic menu defined in XML using XSLT
Author: By
Last change: New definitions of the XSL for showing on Mozilla.
Improve the code
Date: 2004-06-15 07:12
Size: 2,845 bytes
 

Contents

Class file image Download
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 *
 * Copyright (C) 2003-2004 Luis I. Larrateguy <luisignacio@larrateguy.com.ar>
 *
 *     This file is part of XMLMenu
 *  Foobar is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  XMLMenu is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 * @version 0.7.0
 * @copyright 2004 
 **/
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="RSD">
		<xsl:apply-templates/> 
</xsl:template>

<xsl:template match="mainmenu">
	<div id="{generate-id()}" style="width:{@w};z-index:{count(ancestor::node())};" class="mainmenu">
		<div><xsl:value-of select="@text"></xsl:value-of></div>
		<xsl:param name="parentid">generate-id()</xsl:param>
		<xsl:apply-templates select="menuitem">
				<xsl:with-param name="parentid" select="generate-id()" />
		</xsl:apply-templates>
		
	</div>
</xsl:template>

<xsl:template match="submenu">
		<div id="{generate-id()}" style="width:{@w};z-index:{count(ancestor::node())};" class="menu" onMouseOver="show('','{generate-id()}', '');" onMouseOut="hide('{generate-id()}');">
			<xsl:value-of select="@text"></xsl:value-of>
			<xsl:param name="parentid">generate-id()</xsl:param>
			<xsl:apply-templates select="menuitem">
					<xsl:with-param name="parentid"  select="generate-id()" />
			</xsl:apply-templates>
		</div>
</xsl:template>


<xsl:template match="menuitem">
	<xsl:choose>
		<xsl:when test="submenu = ''">
			<div>
				<div id="{generate-id()}" style="" class="menuitem">
					<a href="{@link}"><xsl:value-of select="@text"/></a>
				</div>
				
			</div>
			<xsl:apply-templates />
		</xsl:when>
		<xsl:otherwise>
			<div>
				<xsl:param name="parentid" />
				<xsl:param name="deftop" select="generate-id()" />
				<div id="{generate-id()}" class="menuitem" onMouseOver="show('{$parentid}','{generate-id(submenu)}','{$deftop}');" onMouseOut="hide('{generate-id(submenu)}');">
					<a href="{@link}"><xsl:value-of select="@text"/> ...</a>
				</div>
				<xsl:apply-templates select="submenu"/>
			</div>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

</xsl:stylesheet>