<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	exclude-result-prefixes="xsl xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xhtml="http://www.w3.org/1999/xhtml">
	<xsl:key name="objet" match="orgUnit | program | subProgram | course | person" use="@id"/>
	<xsl:output method="xml" indent="yes"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
		doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
		media-type="text/html" encoding="UTF-8"
		omit-xml-declaration="yes" xml:lang="fr" xml:space="preserve" />
	<xsl:param name="_lang">fr-FR</xsl:param>
	<xsl:param name="baseActionURL" />
	<xsl:param name="absActionURL" />
	<xsl:param name="_pas">10</xsl:param>
	<xsl:param name="debug">0</xsl:param>
	<xsl:param name="_oid" />
	<xsl:param name="_oidSpecialite" />
	<xsl:param name="_oidUe" />
	<xsl:param name="_onglet" />
	<xsl:param name="_profil">profilv3</xsl:param>
	<xsl:param name="_recherche">0</xsl:param>
	<xsl:param name="baseMediaURL">media/</xsl:param>
	<!-- recuperation des param pour les valeurs des formulaires -->
	<xsl:param name="domaine" />
	<xsl:param name="diplome" />
	<xsl:param name="title" />
	<xsl:param name="intitule" />
	<xsl:param name="basket" select="0" />
	<xsl:variable name="idP"><xsl:choose><xsl:when test="$_oidSpecialite!=''"><xsl:value-of select="$_oidSpecialite"/></xsl:when><xsl:otherwise><xsl:value-of select="$_oid"/></xsl:otherwise></xsl:choose></xsl:variable>
	<xsl:variable name="degree"/>
	<!-- Trouver le Fichier des constantes -->
	<xsl:variable name="variablesExt"
		select="document('../commun/variablesExt.xml')" />
	<xsl:variable name="langueCDM" select="/CDM/@language" />
	<!-- FICHIERS INCLUDE UTILISEES   -->
	<xsl:include href="commun_fr-FR.xsl" />
	<xsl:include href="commun/xhtml.xsl" />
	<xsl:template match="/">
		<xsl:call-template name="html" />
	</xsl:template>
	<xsl:template name="user-titreFenetre">
		Catalogue des formations de l'université X
	</xsl:template>
	<xsl:template name="user-navigation">
		<div id="navigation">
			<ul>
				<li><a href="{$absActionURL}/{$_lang}/accueil">Accueil</a></li>
				<li><a href="{$absActionURL}/{$_lang}/liste">Feuilleter</a></li>
				<li>
					<a href="{$absActionURL}/{$_lang}/recherche">Recherche</a>
				</li>
			</ul>
		</div>
	</xsl:template>
	<xsl:template name="user-titre">
		<xsl:value-of select="key('objet', $idP)/programName/text[@language=$_lang]"/>
	</xsl:template>
	<xsl:template name="user-ariane">Vous lisez : > <xsl:choose><xsl:when test="$idP=$_oid"><xsl:value-of select="key('objet', $_oid)/programName/text[@language=$_lang]"/></xsl:when><xsl:otherwise><a href="{$absActionURL}/{$_lang}/fiche/description/{$_oid}"><xsl:value-of select="key('objet', $_oid)/programName/text[@language=$_lang]"/></a> > <xsl:value-of select="substring-after(key('objet', $idP)/programName/text[@language=$_lang],' ')"/></xsl:otherwise></xsl:choose></xsl:template>

	<xsl:template name="user-col_gauche">
	
		<div id="onglets">
			<ul>
				<li><xsl:if test="$_onglet='description' or $_onglet=''"><xsl:attribute name="class">tabbed</xsl:attribute></xsl:if><a href="{$absActionURL}/{$_lang}/fiche/description/{$_oid}/{$_oidSpecialite}">Description</a></li>
				<li><xsl:if test="$_onglet='admission'"><xsl:attribute name="class">tabbed</xsl:attribute></xsl:if><a href="{$absActionURL}/{$_lang}/fiche/admission/{$_oid}">Admission</a></li>
				<li><xsl:if test="$_onglet='programme'"><xsl:attribute name="class">tabbed</xsl:attribute></xsl:if><a href="{$absActionURL}/{$_lang}/fiche/programme/{$_oid}/{$_oidSpecialite}/{$_oidUe}">Programme</a></li>
				<li><xsl:if test="$_onglet='environnement'"><xsl:attribute name="class">tabbed</xsl:attribute></xsl:if><a href="{$absActionURL}/{$_lang}/fiche/environnement/{$_oid}/{$_oidSpecialite}/{$_oidUe}">Environnement</a></li>	
				<li><xsl:if test="$_onglet='international'"><xsl:attribute name="class">tabbed</xsl:attribute></xsl:if><a href="{$absActionURL}/{$_lang}/fiche/international/{$_oid}/{$_oidSpecialite}/{$_oidUe}">International</a></li>
				<li><xsl:if test="$_onglet='insertion'"><xsl:attribute name="class">tabbed</xsl:attribute></xsl:if><a href="{$absActionURL}/{$_lang}/fiche/insertion/{$_oid}/{$_oidSpecialite}/{$_oidUe}">Poursuites d'études - Insertion professionnelle</a></li>
			</ul>
			<br/>
		</div>
		<div id="content">
			<div id="domaine"> 
				<ul>
					<li>Type de Diplôme : <span><xsl:value-of select="/CDM/properties/infoBlock/extension/uniform/constantes/typeDiplome/data[@cdmDegree=key('objet',$idP)/qualification/degree/@degree]/value[@lang=$_lang]"/></span></li>
					<li>Domaine : <span><xsl:value-of select="key('objet',$_oid)/infoBlock/subBlock[@userDefined='HABILITATION']/subBlock[@userDefined='DOMAINE']/subBlock"/></span></li>
					<li>Mention : <span><xsl:value-of select="key('objet',$_oid)/infoBlock/subBlock[@userDefined='HABILITATION']/subBlock[@userDefined='MENTION']/subBlock"/></span></li>
					<li>_oid : <span><xsl:value-of select="$_oid"/></span></li>
					<li>_oidSpecialite : <span><xsl:value-of select="$_oidSpecialite"/></span></li>
					<li>idP : <span><xsl:value-of select="$idP"/></span></li>
					<li>_lang : <span><xsl:value-of select="$_lang"/></span></li>
					<li>nb elements fils description : <span><xsl:value-of select="count(key('objet',$idP)/programDescription/*[@blockLang=$_lang])"/></span></li>
				</ul>
			</div>
			<xsl:choose>
				<xsl:when test="$_onglet='programme'">
					<h2>Programme (<xsl:value-of select="$idP"/>)</h2>
					<xsl:apply-templates select="key('objet',$idP)/programStructure"/>
					<h3>Réglement des études et modalités d'évaluation</h3>
					<xsl:apply-templates select="key('objet',$idP)/regulations/*[@blockLang=$_lang]"/>
					<xsl:if test="key('objet',$idP)/qualification/studyQualification/*[@blockLang=$_lang]/subBlock[@userDefined='CERTIFICATION']/subBlock">
					<h3>Certifications et labels</h3>
					<ul>
						<xsl:apply-templates select="key('objet',$idP)/qualification/studyQualification/*[@blockLang=$_lang]/subBlock[@userDefined='CERTIFICATION']/subBlock"/>
					</ul>
					</xsl:if>
				</xsl:when>
				<xsl:when test="$_onglet='admission'">
					<h2>Admission</h2>
					<h3>En bref</h3>
					<p>Nombre de places : <xsl:value-of select="key('objet',$idP)/admissionInfo/studentPlaces/@places"/></p>
					<p>Date limite d'inscription : <xsl:value-of select="key('objet',$idP)/admissionInfo/registrationDeadline/subBlock[@blockLang=$_lang]"/></p>
					<p>Début des enseignements : <xsl:value-of select="key('objet',$idP)/admissionInfo/teachingStart/subBlock[@blockLang=$_lang]"/></p>
					<xsl:apply-templates select="key('objet',$idP)/admissionInfo/admissionDescription/*[@blockLang=$_lang]"/>
					<h3>Pré-requis</h3>
					<xsl:apply-templates select="key('objet',$idP)/formalPrerequisites/subBlock[@blockLang=$_lang]"/>
					<h3>Coûts des études</h3>
					<xsl:apply-templates select="key('objet',$idP)/expenses/subBlock[@blockLang=$_lang]"/>
				</xsl:when>
				<xsl:when test="$_onglet='environnement'">
					<h2>Environnement</h2>
					<xsl:apply-templates select="key('objet',$idP)/universalAdjustment/subBlock[@blockLang=$_lang]"/>
				</xsl:when>
				<xsl:when test="$_onglet='international'">
					<h2>Etude à l'étranger</h2>
					<xsl:apply-templates select="key('objet',$idP)/studyAbroad/*[@blockLang=$_lang]"/>
					
					<xsl:if test="key('objet',$idP)/studyAbroad/*[@blockLang=$_lang]/subBlock[@userDefined='TYPEMOBILITE']/subBlock">
					<h3>Type de mobilité</h3>
					<ul>
						<xsl:apply-templates select="key('objet',$idP)/studyAbroad/*[@blockLang=$_lang]/subBlock[@userDefined='TYPEMOBILITE']/subBlock"/>
					</ul>
					</xsl:if>
				</xsl:when>
				<xsl:when test="$_onglet='insertion'">
					<h2>Poursuites d'études - Insertion professionnelle</h2>
					<xsl:apply-templates select="key('objet',$idP)/qualification/qualificationDescription/subBlock[@blockLang=$_lang]"/>
					<h3>Poursuites d'études</h3>
					<xsl:apply-templates select="key('objet',$idP)/qualification/studyQualification/subBlock[@blockLang=$_lang]"/>
					<h3>Insertion Profesionnelle</h3>
					<xsl:apply-templates select="key('objet',$idP)/qualification/profession/*[@blockLang=$_lang]"/>
					<xsl:if test="key('objet',$idP)/infoBlock/extension/unrnpdc/lov[@info='rome']">
						<h3>Les métiers préparés</h3>
						<ul><xsl:apply-templates select="key('objet',$idP)/infoBlock/extension/unrnpdc/lov[@info='rome']"/></ul>		
					</xsl:if>
					<xsl:if test="key('objet',$idP)/qualification/profession/*[@blockLang=$_lang]/subBlock[@userDefined='TAUXINSERTION']">
						<h3>Taux d'insertion</h3>
						<xsl:apply-templates select="key('objet',$idP)/qualification/profession/*[@blockLang=$_lang]/subBlock[@userDefined='TAUXINSERTION']"/>		
					</xsl:if>
					
					
				</xsl:when>
				<xsl:otherwise><!-- description -->
					<h2>Description</h2>
					<h3>Résumé de la formation</h3>
					<ul>
					<li>Sigle interne / type d'object : <xsl:value-of select="key('objet',$idP)/infoBlock/subBlock[@userDefined='SIGLE']"/> / <xsl:value-of select="key('objet',$idP)/infoBlock/extension/unrnpdc/typeObjet"/></li>
					<li>Nombre de crédits en entrée : <xsl:value-of select="key('objet',$idP)/admissionInfo/admissionDescription/*[@blockLang=$_lang]/subBlock[@userDefined='ECTSADMISSION']/subBlock[@userDefined='NOMBRE']"/></li>
					<li>Nombre de crédits préparés : <xsl:value-of select="key('objet',$idP)/qualification/credits/@ECTScredits"/></li>
					<li>Durée de la formation : <xsl:value-of select="key('objet',$idP)/programDuration/*[@blockLang=$_lang]"/></li>
					<li>Code Interne de la formation : <xsl:value-of select="key('objet',$idP)/programID"/></li>
					<xsl:if test="key('objet',$idP)/infoBlock/extension/unrnpdc/lov[@info='erasmus']">
						<li>Domaine Erasmus :
						<ul><xsl:apply-templates select="key('objet',$idP)/infoBlock/extension/unrnpdc/lov[@info='erasmus']"/></ul>		
						</li>
					</xsl:if>
					<xsl:if test="key('objet',$idP)/formOfTeaching/*[@blockLang=$_lang]/subBlock[@userDefined='FORMENS']/subBlock">
					<li>Forme de l'enseignement :
					<ul><xsl:apply-templates select="key('objet',$idP)/formOfTeaching/*[@blockLang=$_lang]/subBlock[@userDefined='FORMENS']/subBlock"/></ul>
					</li>
					</xsl:if>
					<xsl:if test="key('objet',$idP)/targetGroup/*[@blockLang=$_lang]/subBlock[@userDefined='TYPEPUBLIC']/subBlock">
					<li>Public cible : <xsl:value-of select="*[@blockLang=$_lang]/subBlock"/>
					<ul><xsl:apply-templates select="key('objet',$idP)/targetGroup/*[@blockLang=$_lang]/subBlock[@userDefined='TYPEPUBLIC']/subBlock"/></ul>
					</li>
					</xsl:if>
					<li>Adresse des enseignements : <xsl:apply-templates select="key('objet',$idP)/teachingPlace"/></li>
					</ul>
					<h3>Description</h3>
					<xsl:apply-templates select="key('objet',$idP)/programDescription/*[@blockLang=$_lang]/subBlock"/>
					<h3>Pré-requis recommandés</h3>
					<xsl:apply-templates select="key('objet',$idP)/recommendedPrerequisites/*[@blockLang=$_lang]/subBlock"/>
					<h3>Compétences et savoirs enseignés</h3>
					<xsl:apply-templates select="key('objet',$idP)/learningObjectives/*[@blockLang=$_lang]/subBlock"/>
					<h3>Stage pratique</h3>
					<xsl:apply-templates select="key('objet',$idP)/qualification/profession/*[@blockLang=$_lang]/subBlock[@userDefined='STAGE']"/>
					<h3>Les mots clés</h3>
					<xsl:apply-templates select="key('objet',$idP)/programDescription/*[@blockLang=$_lang]/searchword"/>
				</xsl:otherwise>
			</xsl:choose>
			<p>Fiche modifiée le <xsl:apply-templates select="key('objet',$idP)/infoBlock/subBlock[@userDefined='MODIFICATION']"/></p>
		</div>
		
		
	
	
	</xsl:template>
	<xsl:template match="searchword[position()=1]">
		<xsl:value-of select="text()"/>
	</xsl:template>
	<xsl:template match="searchword[position()&gt;1]"><xsl:text>, </xsl:text><xsl:value-of select="text()"/>
	</xsl:template>
	<xsl:template match="lov[@info='erasmus']">
		<li>[<xsl:value-of select="@code"/>] <xsl:value-of select="text()"/></li>
	</xsl:template>
	<xsl:template match="lov[@info='rome']">
		<li>[<xsl:value-of select="@code"/>] <xsl:value-of select="text()"/></li>
	</xsl:template>
	<xsl:template match="teachingPlace">
		<xsl:value-of select="adr/extadr"/><xsl:text> </xsl:text>, <xsl:value-of select="adr/street"/><xsl:text>, </xsl:text><xsl:value-of select="adr/pcode"/><xsl:text> </xsl:text><xsl:value-of select="adr/locality"/>
	</xsl:template>
	<xsl:template match="subBlock[@userDefined='TYPEPUBLIC']/subBlock">
		<li><xsl:value-of select="text()"/></li>
	</xsl:template>
	<xsl:template match="subBlock[@userDefined='FORMENS']/subBlock">
		<li><xsl:value-of select="text()"/></li>
	</xsl:template>
	<xsl:template match="subBlock[@userDefined='TYPEMOBILITE']/subBlock">
		<li><xsl:value-of select="text()"/></li>
	</xsl:template>
	<xsl:template match="subBlock[@userDefined='CERTIFICATION']/subBlock">
		<li><xsl:value-of select="text()"/></li>
	</xsl:template>
	<xsl:template match="subBlock[@userDefined='STAGE' or @userDefined='TAUXINSERTION']">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="subBlock[@userDefined='MODIFICATION']">
		<xsl:value-of select="substring(.,9,2)"/><xsl:text>/</xsl:text><xsl:value-of select="substring(.,6,2)"/><xsl:text>/</xsl:text><xsl:value-of select="substring(.,1,4)"/><xsl:text> à </xsl:text><xsl:value-of select="substring(.,12,2)"/><xsl:text>H</xsl:text><xsl:value-of select="substring(.,15,2)"/>mn
	</xsl:template>
	<xsl:template match="programStructure|programStructure//subBlock" >
		<xsl:if test="header"><h3><xsl:value-of select="header"/></h3></xsl:if>
		<xsl:if test="count(refProgram)&gt;0"><ul><xsl:apply-templates select="refProgram"/></ul></xsl:if>
		<xsl:apply-templates select="subBlock"/>
	</xsl:template>
	<xsl:template match="programStructure[refCourse | .//refCourse]" >
		Tableau des ue
	</xsl:template>
	<xsl:template match="refProgram">
		<li><a href="{$absActionURL}/{$_lang}/fiche/description/{$_oid}/{@ref}"><xsl:if test="count(key('objet',@ref)/programName/text[@language=$_lang])=0">Sans nom</xsl:if><xsl:value-of select="key('objet',@ref)/programName/text[@language=$_lang]"/></a></li>
	</xsl:template>
	<xsl:template match="refPerson">
		<h3><xsl:value-of select="@role"/></h3>
		<p><xsl:value-of select="key('objet',@ref)/name/given"/><xsl:text> </xsl:text><xsl:value-of select="key('objet',@ref)/name/family"/></p>
		<p>Tel : <xsl:value-of select="key('objet',@ref)/contactData/telephone"/></p>
		<p><a href="mailto:{key('objet',@ref)/contactData/email/text()}"><xsl:value-of select="key('objet',@ref)/contactData/email"/></a></p>
		<hr/>
	</xsl:template>
	<xsl:template name="user-col_droite">
		<xsl:apply-templates select="key('objet',$idP)/contacts/refPerson"/>
		<h3>En savoir plus</h3>
		<p><xsl:apply-templates select="key('objet',$idP)/webLink"/></p>
	</xsl:template>
</xsl:stylesheet>