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:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:foo="foo" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
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:import href="utils.xsl"/>
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:param name="contextPath">/baco</xsl:param>
<xsl:param name="username">jmachado</xsl:param>
<xsl:param name="name">Jorge Machado</xsl:param>
<xsl:param name="roles">professor,administrador</xsl:param>
<!--<xsl:param name="ACTUAL">pagina_a1.2.1</xsl:param>-->
<!--<xsl:param name="ACTUAL">ficha_trabalhoIncluido</xsl:param>-->
<xsl:param name="ACTUAL">pagina_teste.html</xsl:param>
<xsl:param name="includeXML">oai_dc.xml</xsl:param>
<xsl:template match="/">
<div>
<xsl:apply-templates select="//*[@id=$ACTUAL]" mode="root"/>
</div>
</xsl:template>
<xsl:template match="/" mode="single">
<html>
<head>
<title>O meu Directório ESTG</title>
<style type="text/css">
body
{
color: black;
border: 0;
padding: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
font-family: sans-serif;
font-size: 0.7em;
}
ul
{
margin:0;
}
#header, #header td, #header td a
{
padding-left:10px;
background-color:#396F9D;
color:white;
}
#bigTable
{
width:100%;
}
#latNavContainer
{
width:160px;
vertical-align:top;
}
#footer
{
border-top: 1px solid black;
text-align:center;
}
#latNav
{
padding-left:10px;
background-color:lightgreen;
}
#latNav h2
{
font-family: sans-serif;
font-size: 0.7em;
background-color: blue;
color:yellow;
margin-bottom:0;
}
#latNav ul
{
list-style:none;
padding-left: 15px;
margin-left:0;
}
#latNav li
{
font-size: 0.7em;
white-space:nowrap;
}
#latNav li .selected
{
background-color:green;
}
#topnav
{
padding-left:10px;
background-color:yellow;
}
#content
{
padding:4px;
border: 1px solid black;
}
<!--Blocos do conteudo dos directorios-->
.block
{
margin-bottom:10px;
border-left: 1px solid #8EC73F;
}
.block .head
{
font-style:italic;
}
.block
{
font-family: sans-serif;
font-size: 0.7em;
}
.block ul li p
{
background-color:transparent;
font-style:italic;
}
.block ul li ul li
{
padding-left: 0;
}
.block p, .navLeftMenu h2 {
background-color: #8EC73F;
padding-left: 0;
margin: 0;
}
.block ul
{
list-style:none;
padding-left: 5px;
margin-left:0;
}
.block ul li{
padding-top:3px;
padding-left:0;
margin-left:0;
}
.block a {
color: #4d4d4d;
text-decoration: none;
}
.block a:visited {
/*color: #4d4d4d;*/
text-decoration: none;
}
.block a:hover, .linkUnderlineGrayToGreen a:hover {
color: #8EC73F;
text-decoration: underline;
}
.links p
{
background-color:yellow;
}
.links .block
{
border-left: 1px solid yellow;
}
.columnTable
{
width:100%;
}
.columnTable td
{
margin-left: 10px;
}
td.column {
vertical-align: top;
}
</style>
</head>
<body>
<xsl:call-template name="header"/>
<xsl:apply-templates select="//*[@id=$ACTUAL]" mode="root"/>
<xsl:call-template name="footer"/>
</body>
</html>
</xsl:template>
<xsl:template name="header">
<div id="header">
<h1>Bem vindos ao meu directorio</h1>
Está autenticado como <xsl:value-of select="$name"/> com os papeis: <xsl:value-of select="$roles"/>
</div>
</xsl:template>
<xsl:template name="footer">
<div id="footer">
Sistema de Directorios da <a href="http://www.estgp.pt">ESTG</a> 2008
</div>
</xsl:template>
<!--
===========================================================
| Página de Apresentação de um Nó no Corpo da Página
===========================================================
-->
<xsl:template match="d:directory" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<xsl:apply-templates select="." mode="childs"/>
</xsl:template>
<xsl:template match="d:node" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td id="leftPage">
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<div class="portal">
<xsl:apply-templates select="." mode="childs"/>
</div>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="d:directory" mode="childs">
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</td>
<xsl:if test="d:node">
<xsl:choose>
<xsl:when test="d:groupsDeclaration">
<xsl:for-each select="d:groupsDeclaration/d:group">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../d:node[@group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:node">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</tr>
</table>
</xsl:template>
<xsl:template match="d:node" mode="childs">
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</td>
<xsl:if test="d:node">
<xsl:choose>
<xsl:when test="d:groupsDeclaration">
<xsl:for-each select="d:groupsDeclaration/d:group">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../d:node[@group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:node">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</tr>
</table>
</xsl:template>
<xsl:template match="d:node" mode="block">
<div class="block">
<p><xsl:apply-templates select="." mode="link"/></p>
<ul>
<xsl:for-each select="d:leaf">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
<xsl:for-each select="d:node">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:template>
<!--
===========================================================
| Página de Apresentação de uma Folha no Corpo da Página
===========================================================
-->
<xsl:template match="d:leaf" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table id="bigTable">
<tr>
<td id="leftPage">
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<xsl:apply-templates select="." mode="bodyContent"/>
</td>
</tr>
</table>
</xsl:template>
<!--<xsl:function name="d:parse" as="document-node()">
<xsl:param name="s" as="xs:string"/>
<xsl:sequence select="doc(concat('data:text/xml','<ola>teste</ola>'))"/>
--><!--<xsl:sequence select="doc(concat('data:text/xml',$s))"/> --><!--
</xsl:function>-->
<!--
===========================================================
| Barra de Navegação Superior
===========================================================
-->
<xsl:template match="d:leaf" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
>
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:node" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
>
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:directory" mode="topNav">
<!--O Baco faz isto por nós para que a barra superior fique alinhada correctamente-->
<!--<div id="topnav">
<ul>
<li class="navPlace">
<xsl:call-template name="homeLink"/>
</li>
<li class="navPlace">
>
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>-->
</xsl:template>
<xsl:template match="d:directory" mode="navBack">
<li class="navPlace">
<xsl:call-template name="homeLink"/>
</li>
<li class="navPlace">
>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBack">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<!--
===========================================================
| Barra de Navegação Lateral Esquerda
===========================================================
-->
<xsl:template match="d:node" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
<xsl:apply-templates select="." mode="label"/>
</li>
</xsl:when>
<xsl:otherwise>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<li class="navPlace">...<xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
<!--
===========================================================
| Apresentar Todo o Directorio em árvore - NAO ESTA EM USO DE MOMENTO
===========================================================
-->
<xsl:template name="treeRoot">
<xsl:if test="/d:directory/d:node">
<ul>
<xsl:for-each select="/d:directory/d:node">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="d:node" mode="treeLoop">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p><xsl:value-of select="@label"/></p>
<xsl:if test="./d:leaf">
<xsl:for-each select="./d:leaf">
<xsl:apply-templates select="." mode="tree"/>
</xsl:for-each>
</xsl:if>
<xsl:if test="./d:node">
<ul>
<xsl:for-each select="./d:node">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="d:leaf" mode="tree">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p>...<xsl:apply-templates mode="label"/></p>
</div>
</xsl:template>
<!--
===========================================================
| TEMPLATES DE OUTROS ESQUEMAS
===========================================================
-->
<!-- Foo Templates -->
<xsl:template match="foo:record">
<p>titulo:<xsl:value-of select="foo:title"/></p>
<p>texto:<xsl:value-of select="foo:text"/></p>
</xsl:template>
<!--OAIDC Templates-->
<xsl:template match="oai_dc:dc">
<table>
<tr>
<th colspan="2">Registo Bibliografico</th>
</tr>
<xsl:apply-templates select="./dc:*"/>
</table>
</xsl:template>
<xsl:template match="dc:*">
<tr>
<th><xsl:value-of select="local-name(.)"/></th>
<td><xsl:value-of select="./text()"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>