Subversion Repositories bacoAlunos

Rev

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

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
        <xsl:param name="dirStartPath"><xsl:value-of select="$contextPath"/>/dir</xsl:param>
       
        <xsl:template match="d:directory" mode="link">
                <a>
                        <xsl:attribute name="href">
                                <xsl:value-of select="$dirStartPath"/>/<xsl:value-of select="@id"/>?role=<xsl:value-of select="@targetRole"/>&amp;menu=<xsl:value-of select="@menuKey"/>
                        </xsl:attribute>
                        <xsl:apply-templates select="." mode="label"/>
                </a>
        </xsl:template>
       
        <xsl:template match="d:node" mode="link">
                <a>
                        <xsl:attribute name="href">
                                <xsl:choose>
                                        <xsl:when test="@idPrefixSize">
                                                <xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="substring(@id,@idPrefixSize+1)"/>                                                     
                                        </xsl:when>
                                        <xsl:otherwise>
                                                <xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/>                                                
                                        </xsl:otherwise>
                                </xsl:choose>
                        </xsl:attribute>
                        <xsl:apply-templates select="." mode="label"/>
                </a>
        </xsl:template>
        <xsl:template match="d:leaf" mode="link">
                <a>
                        <xsl:attribute name="href">
                                <xsl:choose>
                                        <xsl:when test="string(@absolute)='true'">                                             
                                                        <xsl:value-of select="@url"/>  
                                        </xsl:when>                                    
                                        <xsl:when test="@idPrefixSize"><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="substring(@id,@idPrefixSize+1)"/></xsl:when>                           
                                        <xsl:when test="@remoteExtensionRoot='true'"><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/></xsl:when>
                                        <xsl:otherwise><xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/><xsl:value-of select="@url"/></xsl:otherwise>
                                </xsl:choose>
                        </xsl:attribute>                               
                        <xsl:apply-templates select="." mode="label"/>
                </a>
        </xsl:template>
       
       
       
        <xsl:template match="d:directory" mode="linkParent">/<xsl:value-of select="@id"/></xsl:template>
       
        <xsl:template match="d:node" mode="linkParent">
                <xsl:choose>
                        <xsl:when test="@idPrefixSize"><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="substring(@id,@idPrefixSize+1)"/></xsl:when>
                        <xsl:otherwise><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/></xsl:otherwise>
                </xsl:choose>
        </xsl:template>


       
        <xsl:template match="d:leaf" mode="linkParent">
                <xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/>
        </xsl:template>
       
        <xsl:template match="d:leaf" mode="bodyContent">
                <xsl:choose>
                        <xsl:when test="string(@xml) = 'true'">
                                <xsl:variable name="bodyDoc" select="document($includeXML)"/>
                                <xsl:apply-templates select="$bodyDoc/*"/>     
                        </xsl:when>
                        <xsl:otherwise>
                                @@BODY_CONTENT@@
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>

        <xsl:template match="d:directory" mode="label">
                <xsl:value-of select="@label"/>
        </xsl:template>
        <xsl:template match="d:node" mode="label">
                <xsl:value-of select="@label"/>
        </xsl:template>
        <xsl:template match="d:leaf" mode="label">
                <xsl:value-of select="@label"/>
        </xsl:template>
       
       
        <!--Static templates-->
        <xsl:template name="leafsBlockLabel">
                Links
        </xsl:template>
        <xsl:template name="homeLink">
                <a>
                        <xsl:attribute name="href"><xsl:value-of select="$contextPath"/></xsl:attribute>
                        home
                </a>
        </xsl:template>
   
</xsl:stylesheet>