<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="NavType">TOP</xsl:param>
    <xsl:output method="html" omit-xml-declaration="yes"/>

    <xsl:template match="/NavNodes">
    <xsl:comment>Top Navigation XSL for Microsoft Office Live Small Business Custom Navigation Module</xsl:comment>
    <xsl:comment>(C) Copyright 2008 SoftPrizm.com - http://softprizm.com - All Rights Reserved.</xsl:comment>
    <xsl:comment>You are free to use and modify this XSL, but the above copyright notice must be left intact.</xsl:comment>
        <table cellpadding="0" cellspacing="0" class="MSC_PrimaryNavFrame">
            <tr>
				<xsl:for-each select="NavNode">
				<xsl:variable name="ChildSelected" select="count(NavNode[@selected='true']) != '0'" />
				<xsl:variable name="SelfOrChildSelected" select="$ChildSelected or (@selected='true')" />
					<td>
					<xsl:attribute name="class">
						<xsl:choose>
							<xsl:when test="$SelfOrChildSelected">MSC_PrimaryNavLinkFrame-On</xsl:when>
							<xsl:otherwise>MSC_PrimaryNavLinkFrame</xsl:otherwise>
						</xsl:choose>
					</xsl:attribute>
					<a>
						<xsl:attribute name="href">
							/<xsl:value-of select="@url"/>
						</xsl:attribute>
						<xsl:attribute name="class">
							<xsl:choose>
							    <xsl:when test="$SelfOrChildSelected">MSC_PrimaryNavLink-On</xsl:when>
							    <xsl:otherwise>MSC_PrimaryNavLink</xsl:otherwise>
							</xsl:choose>
						</xsl:attribute>
						<xsl:value-of select="@name"/>
					</a>
					</td>
					<td class="MSC_PrimaryNavLeftSpace">
					</td>
					<td class="MSC_PrimaryNavRightSpace">
					</td>
				</xsl:for-each>
    	        <td class="MSC_TopNavEnd"></td>
        	</tr>
        </table>
        <xsl:for-each select="NavNode">
            <xsl:variable name="ChildSelected" select="count(NavNode[@selected='true']) != '0'" />
            <xsl:variable name="SelfOrChildSelected" select="$ChildSelected or (@selected='true')" />
            <xsl:if test="$SelfOrChildSelected">
                <xsl:if test="count(child::*) != '0'">
                  <table cellpadding="0" cellspacing="0" class="MSC_SecondaryNavFrame" >
                        <tr>
                          <xsl:for-each select="NavNode">
                               <td>
                                    <xsl:attribute name="class">
                                        <xsl:choose>
                                            <xsl:when test="@selected='true'">MSC_SecondaryNavLinkFrame-On</xsl:when>
                                            <xsl:otherwise>MSC_SecondaryNavLinkFrame</xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:attribute>
                                    <a>
                                        <xsl:attribute name="href">
                                            /<xsl:value-of select="@url"/>
                                        </xsl:attribute>
                                        <xsl:attribute name="class">
                                            <xsl:choose>
                                                <xsl:when test="@selected='true'">MSC_SecondaryNavLink-On</xsl:when>
                                                <xsl:otherwise>MSC_SecondaryNavLink</xsl:otherwise>
                                            </xsl:choose>

                                        </xsl:attribute>
                                        <xsl:value-of select="@name"/>
                                    </a>
                                </td>
                            <td>
                                 <xsl:attribute name="class">MSC_SecondaryNavLeftSpace</xsl:attribute>
                            </td>
                            <td>
                                 <xsl:attribute name="class">MSC_SecondaryNavRightSpace</xsl:attribute>
                            </td>
                          </xsl:for-each>
                          <td class="MSC_TopNavEnd"></td>
		 			    </tr>   
                   </table>
                </xsl:if>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>


