Subversion Repositories bacoAlunos

Rev

Rev 1097 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"  version="1.0" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
        <xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" />
        <xsl:param name="contextPath">/baco</xsl:param>
       
        <xsl:template match="/">
                <table id="menuTop" cellpadding="0" cellspacing="0">
                        <tr>
                                <td>
                                        <ul id="menu_dropdown" class="menubar">
                                                <xsl:apply-templates select="/d:directory/d:leaf" mode="root"/>
                                        </ul>  
                                </td>
                        </tr>
                </table>       
        </xsl:template>
       
        <xsl:template match="d:leaf" mode="root">
                <li class="submenu">
                        <a>
                                <xsl:attribute name="href">
                                        <xsl:choose>
                                                <xsl:when test="@url and @absolute='true'">
                                                        <xsl:value-of select="@url"/>
                                                </xsl:when>
                                                <xsl:when test="@url and @absolute='false'">
                                                        <xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
                                                </xsl:when>
                                                <xsl:otherwise>#</xsl:otherwise>
                                        </xsl:choose>  
                                </xsl:attribute>
                                <xsl:value-of select="@label"/>
                        </a>
                        <xsl:if test="./d:leaf">
                                <div class="shadow">                                    
                                        <ul class="menu">
                                                <xsl:for-each select="./d:leaf">
                                                        <li>
                                                                <a>
                                                                        <xsl:attribute name="href">
                                                                                <xsl:choose>
                                                                                        <xsl:when test="@url and @absolute='true'">
                                                                                                <xsl:value-of select="@url"/>
                                                                                        </xsl:when>
                                                                                        <xsl:when test="@url and @absolute='false'">
                                                                                                <xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
                                                                                        </xsl:when>
                                                                                        <xsl:otherwise>#</xsl:otherwise>
                                                                                </xsl:choose>  
                                                                        </xsl:attribute>
                                                                        <xsl:value-of select="@label"/>
                                                                </a>
                                                        </li>
                                                </xsl:for-each>
                                        </ul>
                                </div>
                        </xsl:if>
                </li>
        </xsl:template>



    <xsl:template match="/" mode="new" >
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">

                </div>
                <ul class="nav navbar-nav">
                    <xsl:apply-templates select="/d:directory/d:leaf" mode="root"/>
                </ul>


            </div>

        </nav>
    </xsl:template>


    <xsl:template match="d:leaf" mode="new">
        <xsl:choose>
            <xsl:when test="./d:leaf">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" >
                        <xsl:attribute name="href">
                            <xsl:choose>
                                <xsl:when test="@url and @absolute='true'">
                                    <xsl:value-of select="@url"/>
                                </xsl:when>
                                <xsl:when test="@url and @absolute='false'">
                                    <xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
                                </xsl:when>
                                <xsl:otherwise>#</xsl:otherwise>
                            </xsl:choose>
                        </xsl:attribute>
                        <xsl:value-of select="@label"/>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <xsl:for-each select="./d:leaf">
                            <li>
                                <a>
                                    <xsl:attribute name="href">
                                        <xsl:choose>
                                            <xsl:when test="@url and @absolute='true'">
                                                <xsl:value-of select="@url"/>
                                            </xsl:when>
                                            <xsl:when test="@url and @absolute='false'">
                                                <xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
                                            </xsl:when>
                                            <xsl:otherwise>#</xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:attribute>
                                    <xsl:value-of select="@label"/>
                                </a>
                            </li>
                        </xsl:for-each>
                    </ul>
                </li>
            </xsl:when>
            <xsl:otherwise>
                <li>
                    <a>
                        <xsl:attribute name="href">
                            <xsl:choose>
                                <xsl:when test="@url and @absolute='true'">
                                    <xsl:value-of select="@url"/>
                                </xsl:when>
                                <xsl:when test="@url and @absolute='false'">
                                    <xsl:value-of select="$contextPath"/><xsl:value-of select="@url"/>
                                </xsl:when>
                                <xsl:otherwise>#</xsl:otherwise>
                            </xsl:choose>
                        </xsl:attribute>
                        <xsl:value-of select="@label"/>
                    </a>
                </li>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>