<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Feuille de transformation INCLUDE
Ce ficher est choisi automatiquement par les XSL
     Author: Loic Pénet, lpenet@poleuniv-lille-npdc.fr
     Equipe : Claude Vieville, Brigitte Wallaert. CRI Université des Sciences et Technologies de Lille
     Version $Revision: 1.4 $
     -->
	 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns2="http://cdm-fr.fr/2011/CDM-frSchema">
	<!--  J'ai retiré les variables d'entete car inclu dans un autre fichier -->
	<!-- *************** ATTENTION Ce fichier est utilisé en INclude ***************-->
	<xsl:template name="localEtablissement">
		<xsl:param name="intitule"/>
		<!-- Vos meta -->
		<!--        -->
		<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"/>
		<meta name="keywords" content="{$intitule},{$variablesExt/variables/pageTitle/header[@type='2']/value[@lang=$_lang]}"/>
		<meta name="description" content="{$variablesExt/variables/pageTitle/header[@type='2']/value[@lang=$_lang]}"/>
		<title>
			<xsl:value-of select="$intitule"/> (U.S.T.L.)</title>
		<!-- les feuilles de style -->
		<link media="all" type="text/css" rel="stylesheet" href="{$baseCssURL}/{$variablesExt/variables/programVar/variable[@type='nomCssPrincipal']/@value}"/>
		<link rel="alternate stylesheet" type="text/css" href="{$baseCssURL}/{$variablesExt/variables/programVar/variable[@type='nomCssAlternate']/@value}" title="style contraste"/>
		<!-- Vos script -->
		<!-- <script type="text/javascript" src="http://ustl1.univ-lille1.fr/projetUstl/navigation/script/USTL.js"/> -->
		<script type="text/javascript">
function nleFenetre(url) 
            { 
            options = "location=yes, scrollbars=yes,resizable=yes,toolbar=yes,status=yes,menubar=yes,width=700,height=500" ; options += ",top=" + String(window.screen.Height/2 - 400) ;
            options += ",left=" + String(window.screen.Width/2 - 300) ; var wNleF = window.open(url,"wNleF",options);
            return false ; 
            }
        </script>
	</xsl:template>
	<!--  Dans ce fichier, il faut remplir toutes les valeurs '(...)' pour adapter à votre Etablissement -->
	<xsl:template name="piedDePage">
		<!--  A modifier -->
		<p class="uportal-text-small">
			<a>
				<xsl:attribute name="href"><xsl:value-of select="/CDM/orgUnit[orgUnitKind/@orgType='universitet']/webLink[@role='homepage']/href"/></xsl:attribute>
				<xsl:value-of select="/CDM/orgUnit[orgUnitKind/@orgType='universitet']/orgUnitName/text"/>
			</a>
		</p>
	</xsl:template>
	<xsl:template name="ECTSentree">
		<xsl:choose>
			<!-- modifier pour solution non USTL (exemple)
            <xsl:when test="/CDM/programqualification/@degree='vgs'"></xsl:when>
            <xsl:when test="/CDM/programqualification/@degree='folkehogskole'"></xsl:when>
            <xsl:when test="/CDM/programqualification/@degree='bachelor'">0</xsl:when>
            <xsl:when test="/CDM/programqualification/@degree='master'"></xsl:when>
            <xsl:when test="/CDM/programqualification/@degree='phd'"></xsl:when>
            <xsl:when test="/CDM/programqualification/@degree='fagskole'"></xsl:when>
            -->
			<!-- ORIGINAL <xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-bac'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-li'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-lip'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-DUT'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-DEUST'">30</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-iup'">120</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-dii'">120</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-mar'">180</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-map'">180</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-mas'">180</xsl:when>
			<xsl:when test="normalize-space(/CDM/programqualification/degree)='TI-do'">300</xsl:when>
			-->
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-bac'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-li'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-lip'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-DUT'">0</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-DEUST'">30</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-iup'">120</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-dii'">120</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-mar'">180</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-map'">180</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-mas'">180</xsl:when>
			<xsl:when test="normalize-space(/CDM/program/qualification/ns2:degree)='TI-do'">300</xsl:when>
			<xsl:otherwise>0</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--  -->
	<xsl:template match="infoBlock">
		<xsl:apply-templates select="node()"/>
		rot<br/>
	</xsl:template>
	<!--  -->
	<xsl:template match="contacts">
		<xsl:apply-templates select="person | refPerson"/>
	</xsl:template>
	<!--  -->
	<xsl:template match="refPerson">
		<xsl:variable name="ref" select="@ref"/>
		<xsl:apply-templates select="/CDM/person[@ident=$ref]"/>
	</xsl:template>

	<!--  -->
	<xsl:template match="person">
		<h3 class="TitreTD">&gt; <xsl:value-of select="./role"/>
		</h3>
		<xsl:variable name="leRole" select="normalize-space(./role)"/>
		<!--  -->
		<xsl:choose>
			<xsl:when test="not($variablesExt/variables/affichageVar/optionAffichage[@type=$leRole]/@adress=0)">
				<!-- adresse -->
				<xsl:apply-templates select="./contactData"/>
			</xsl:when>
			<xsl:otherwise>
				<!-- pas adresse -->
				<xsl:value-of select="./name/family"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--  -->
	<xsl:template match="contactData">
		<!-- Traitement mail vide -->
		<xsl:choose>
			<xsl:when test="not(./email='')">
				<p class="aMail">
					<xsl:apply-templates select="./email"/>
				</p>
			</xsl:when>
			<xsl:otherwise>
				<div class="p">
					<xsl:value-of select="../name/family"/>
				</div>
			</xsl:otherwise>
		</xsl:choose>
		<!-- Traitement telephone et Fax vide -->
		<xsl:if test="not(normalize-space(./telephone)='')">
			<p class="aPhone" title="Telephone">
				<xsl:value-of select="./telephone"/>
			</p>
		</xsl:if>
		<xsl:if test="not(normalize-space(./fax)='')">
			<p class="aFax" title="Fax">
				<xsl:value-of select="./fax"/>
			</p>
		</xsl:if>
		<xsl:apply-templates select="./adr/extadr"/>
	</xsl:template>
	<!--  -->
	<xsl:template match="extadr">
		<div class="p">
			<xsl:value-of select="."/>
		</div>
	</xsl:template>
	<!--  -->
	<xsl:template match="email">
		<a accesskey=" ">
			<xsl:attribute name="title"><xsl:value-of select="$variablesExt/variables/navigationVar/link[@type='1']/linkTitle/value[@lang=$_lang]"/><xsl:text> </xsl:text><xsl:value-of select="../../name/family"/></xsl:attribute>
			<xsl:attribute name="href"><xsl:variable name="value" select="normalize-space(.)"/><xsl:value-of select="concat('mailto:' , $value)"/></xsl:attribute>
			<xsl:value-of select="."/>
		</a>
	</xsl:template>
	<!-- -->
	<xsl:template name="afficheTitre">
		<xsl:param name="titre"/>
		<img src="{$baseMediaURL}{$baseCanalURL}/pictos/carre44{$couleur}.gif" alt="" width="13"/>
		<xsl:text> </xsl:text>
		<span class="Titre3">
			<b class="{$couleur}">
				<xsl:choose>
					<xsl:when test="not($titre='')">
						<xsl:value-of select="$titre"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:apply-templates select="header"/>
					</xsl:otherwise>
				</xsl:choose>
			</b>
		</span>
		<br/>

	</xsl:template>
	<xsl:template name="Titreheader">
		<xsl:param name="titre"/>
		<xsl:if test="count(.//text()[string-length(normalize-space(.)) &gt; 0]|subBlock|refCourse|refProgram|refOrgUnit)!=0 or $variablesExt/variables/affichageVar/optionAffichage[@type='rubriqueVide']/@value!=0">
			<xsl:choose>
				<xsl:when test="count(header)=0">
					<xsl:call-template name="afficheTitre">
						<xsl:with-param name="titre" select="$titre"/>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:apply-templates select="header">
						<xsl:with-param name="titre" select="$titre"/>
					</xsl:apply-templates>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
	<xsl:template match="header">
		<xsl:param name="titre"/>
		<img src="{$baseMediaURL}{$baseCanalURL}/pictos/carre44{$couleur}.gif" alt="" width="13"/>
		<xsl:text> </xsl:text>
		<span class="Titre3">
			<b class="{$couleur}">
				<xsl:choose>
					<xsl:when test="not(normalize-space(.)='')">
						<xsl:value-of select="."/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$titre"/>
					</xsl:otherwise>
				</xsl:choose>
			</b>
		</span>
		<br/>
	</xsl:template>
	<!--  -->
	<xsl:template match="subBlock[ancestor::altLangBlock]">
		<div class="p">
			<xsl:apply-templates/>
		</div>
	</xsl:template>
	<!--  -->
	<xsl:template match="subBlock">
		<!--   je ne peux traiter que si attribut de language
        (<xsl:value-of select="$langueFluxCDM"/>)(<xsl:value-of select="$variablesExt/variables/affichageVar/optionAffichage[@type='lang']/@select"/>)<br/>-->
		<xsl:if test="$variablesExt/variables/affichageVar/optionAffichage[@type='lang']/@select = $langueFluxCDM">
			<div class="p">
				<xsl:apply-templates/>
			</div>
		</xsl:if>
	</xsl:template>
	<!-- langueCourante -->
	<xsl:template match="altLangBlock">
		<xsl:if test="./@blockLang = $langueFluxCDM">
			<xsl:apply-templates select="node()"/>
		</xsl:if>
	</xsl:template>
	<!--  -->
	<xsl:template name="texteFormate">
		<xsl:param name="titre"/>
		<xsl:if test="count(text()[string-length(normalize-space(.)) &gt; 0]|subBlock|refCourse|refProgram|refOrgUnit|ns2:infoBlock)!=0 or $variablesExt/variables/affichageVar/optionAffichage[@type='rubriqueVide']/@value!=0">
			<xsl:apply-templates select="text() | *[not(name()='header')]">
				<xsl:with-param name="titre" select="$titre"/>
			</xsl:apply-templates>
			<br/>
			<img src="{$baseMediaURL}{$baseCanalURL}/trait.gif" alt=" " width="460" height="3"/>
			<br/>
			<br/>
		</xsl:if>
	</xsl:template>
	<!--  -->
	<xsl:template name="texteFormateCourseDescription">
		<xsl:param name="titre"/>
		<xsl:if test="count(text()[string-length(normalize-space(.)) &gt; 0]|subBlock|refCourse|refProgram|refOrgUnit|ns2:infoBlock)!=0 or $variablesExt/variables/affichageVar/optionAffichage[@type='rubriqueVide']/@value!=0">
			<xsl:value-of select="$titre"/>
			<br/>
			<img src="{$baseMediaURL}{$baseCanalURL}/trait.gif" alt=" " width="460" height="3"/>
			<br/>
			<br/>
		</xsl:if>
	</xsl:template>
	<!--  -->
	<xsl:template match="text">
		<xsl:value-of select="."/>
	</xsl:template>
	<xsl:template match="italic">
		<i>
			<xsl:apply-templates select="node()"/>
		</i>
	</xsl:template>
	<!--  -->
	<xsl:template match="bold">
		<b>
			<xsl:apply-templates select="node()"/>
		</b>
	</xsl:template>
	<!--  -->
	<xsl:template match="list">
		<ul>
			<!-- ORIGINAL <xsl:apply-templates select="listItem"/> -->
			<xsl:apply-templates select="node()"/>
		</ul>
	</xsl:template>
	<xsl:template match="listItem">
		<li>
			<xsl:apply-templates select="node()"/>
		</li>
	</xsl:template>
	<xsl:template match="picture">
		<i>
			<xsl:apply-templates select="node()"/>
		</i>
	</xsl:template>
	<!--  -->
	<xsl:template match="webLink">
		<xsl:param name="lienExterieur"/>
		<xsl:param name="menu"/>
		<xsl:variable name="http" select="normalize-space(./href)"/>
		<xsl:choose>
			<xsl:when test="not($http='') and ($menu = 1)">
				<p class="aURL">
					<xsl:call-template name="liensuRL">
						<xsl:with-param name="lienExterieur" select="$lienExterieur"/>
					</xsl:call-template>
				</p>
			</xsl:when>
			<xsl:when test="not($http='')">
				<xsl:call-template name="liensuRL">
					<xsl:with-param name="lienExterieur" select="$lienExterieur"/>
				</xsl:call-template>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<!--  -->
	<xsl:template name="liensuRL">
		<xsl:param name="lienExterieur"/>
		<xsl:variable name="linkName" select="./linkName"/>
		<xsl:variable name="intitule">
			<xsl:choose>
				<xsl:when test="not($linkName = '')">
					<xsl:value-of select="$linkName"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="./@role='homepage'">
							<xsl:value-of select="$variablesExt/variables/navigationVar/link[@type='17']/navigationItem/value[@lang=$_lang]"/>
						</xsl:when>
						<xsl:when test="./@role='learningObjectMetadata'">
							<xsl:value-of select="$variablesExt/variables/navigationVar/link[@type='15']/navigationItem/value[@lang=$_lang]"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$variablesExt/variables/navigationVar/link[@type='nd']/navigationItem/value[@lang=$_lang]"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<a accesskey=" ">
			<xsl:attribute name="title"><xsl:value-of select="$variablesExt/variables/navigationVar/link[@type='0']/linkTitle/value[@lang=$_lang]"/><xsl:text> </xsl:text><xsl:value-of select="$intitule"/></xsl:attribute>
			<xsl:if test="$lienExterieur = 1">
				<xsl:attribute name="onclick">return nleFenetre('<xsl:value-of select="normalize-space(./href)"/>')</xsl:attribute>
			</xsl:if>
			<xsl:attribute name="href"><xsl:apply-templates select="href"/></xsl:attribute>
			<xsl:value-of select="$intitule"/>
		</a>
	</xsl:template>
	<!--  -->
	<xsl:template match="href">
		<xsl:value-of select="normalize-space(.)"/>
	</xsl:template>
	<xsl:template match="linkName"> </xsl:template>
	<xsl:template name="traitdate">
		<xsl:param name="date"/>
		<xsl:variable name="long">
			<xsl:value-of select="string-length($date)-4"/>
		</xsl:variable>
		<xsl:variable name="temp">
			<xsl:value-of select="substring($date , 5 ,$long)"/>
		</xsl:variable>
		<xsl:variable name="annee">
			<xsl:value-of select="substring-before($date , $temp)"/>
		</xsl:variable>
		<xsl:variable name="mois">
			<xsl:choose>
				<xsl:when test="string-length($temp)=4">
					<xsl:value-of select="substring($temp , 1,2)"/>
				</xsl:when>
				<xsl:when test="string-length($temp)=3">erreur</xsl:when>
				<xsl:when test="string-length($temp)=2">
					<xsl:value-of select="substring($temp , 1 ,1)"/>
					<xsl:value-of select="substring-before($temp , substring($temp , 3 ,1))"/>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="jour">
			<xsl:choose>
				<xsl:when test="string-length($temp)=4">
					<xsl:value-of select="substring($temp , 3 ,2)"/>
				</xsl:when>
				<xsl:when test="string-length($temp)=3">erreur</xsl:when>
				<xsl:when test="string-length($temp)=2">
					<xsl:value-of select="substring($temp , 2 ,1)"/>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="lemois">
			<xsl:choose>
				<xsl:when test="number($mois)=1">Janvier</xsl:when>
				<xsl:when test="number($mois)=2">Février</xsl:when>
				<xsl:when test="number($mois)=3">Mars</xsl:when>
				<xsl:when test="number($mois)=4">Avril</xsl:when>
				<xsl:when test="number($mois)=5">Mai</xsl:when>
				<xsl:when test="number($mois)=6">Juin</xsl:when>
				<xsl:when test="number($mois)=7">Juillet</xsl:when>
				<xsl:when test="number($mois)=8">Août</xsl:when>
				<xsl:when test="number($mois)=9">Septembre</xsl:when>
				<xsl:when test="number($mois)=10">Octobre</xsl:when>
				<xsl:when test="number($mois)=11">Novembre</xsl:when>
				<xsl:when test="number($mois)=12">Décembre</xsl:when>
			</xsl:choose>
		</xsl:variable> le <xsl:value-of select="$jour"/>
		<xsl:text>  </xsl:text>
		<xsl:value-of select="$lemois"/>
		<xsl:text>  </xsl:text>
		<xsl:value-of select="$annee"/>
	</xsl:template>
	<!--  -->
	<xsl:template name="content">
		<!--_______________________debut aide___________________________-->
		<xsl:if test="$_recherche=''">
			<h2 class="TI-map">
				<img width="13" alt=" " src="{$baseMediaURL}{$baseCanalURL}/pictos/carre44TI-map.gif"/>
				<!-- Bienvenue sur ... -->
				<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='100']/titreRub/value[@lang=$_lang]"/>
				<xsl:text> </xsl:text>
				<xsl:value-of select="CDM/orgUnit[orgUnitKind/@orgType='universitet']/orgUnitAcronym"/>
			</h2>
			<xsl:apply-templates select="/CDM/orgUnit[orgUnitKind/@orgType='universitet']/infoBlock/subBlock[@userDefined='uniform']"/>
		</xsl:if>
		<!-- Comment rechercher une formation ? -->
		<h2 class="TI-map">
			<img width="13" alt=" " src="{$baseMediaURL}{$baseCanalURL}/pictos/carre44TI-map.gif"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='101']/titreRub/value[@lang=$_lang]"/>
		</h2>
		<xsl:choose>
			<xsl:when test="$_recherche=0">
				<!-- Par le schéma des étude -->
				<h3>
					<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='0']/titreRub/value[@lang=$_lang]"/>
				</h3>
				<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='0']/value[@lang=$_lang]"/>
				<br/>
			</xsl:when>
			<xsl:when test="$_recherche=1">
				<!-- domaines professionnels -->
				<h3>
					<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='4']/titreRub/value[@lang=$_lang]"/>
				</h3>
				<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='4']/value[@lang=$_lang]"/>
				<br/>
			</xsl:when>
			<xsl:when test="$_recherche=2">
				<!-- Recherche par métiers. -->
				<h3>
					<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='1']/titreRub/value[@lang=$_lang]"/>
				</h3>
				<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='1']/value[@lang=$_lang]"/>
				<br/>
			</xsl:when>
			<xsl:when test="$_recherche=3">
				<!-- Recherche par fonctions professionnelles -->
				<h3>
					<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='1']/titreRub/value[@lang=$_lang]"/>
				</h3>
				<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='1']/value[@lang=$_lang]"/>
				<br/>
			</xsl:when>
			<xsl:otherwise>
				<!-- Recherche avec avec plusieurs critères -->
				<h3>
					<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='1']/titreRub/value[@lang=$_lang]"/>
				</h3>
				<xsl:value-of select="$variablesExt/variables/contentVar/content[@type='1']/value[@lang=$_lang]"/>
				<br/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
 <xsl:template match="teachingPlace">
    <h3 class="TitreTD"> &gt;<xsl:text> </xsl:text>
      <xsl:value-of select="$variablesExt/variables/titreVar/titreRub[@type='26']/value[@lang=$_lang]"/>
    </h3>
   <xsl:value-of select="adr/pobox"/><xsl:text> </xsl:text>
 <xsl:value-of select="adr/extadr"/><xsl:text> </xsl:text>

 <xsl:value-of select="adr/street"/> <br/>
 
 <xsl:value-of select="adr/pcode"/><xsl:text> </xsl:text><xsl:value-of select="adr/locality"/>
 <br/> 
 <xsl:value-of select="adr/region"/><xsl:text> </xsl:text><xsl:value-of select="adr/country"/>
 <br/>
      <!--A modifier en redirigeant sur un plan -->
      <!--    
<a title="" accesskey="">
<xsl:attribute name="href">http://ustl1.univ-lille1.fr/projetUstl/images/carte_campus.jpg</xsl:attribute>
<xsl:attribute name="onclick">return nleFenetre('http://ustl1.univ-lille1.fr/projetUstl/images/carte_campus.jpg')</xsl:attribute>
<xsl:value-of select="."/></a>
    		 -->
      <xsl:value-of select="infoBlock"/>
    <!-- OPTION <xsl:apply-templates select="adr"/>   -->
  </xsl:template>
</xsl:stylesheet>
