<!-- 2011-09-26 changement des adresses des référentiels suite changement serveur --><axsl:stylesheet xmlns:xx="http://xml.sandre.eaufrance.fr/scenario/ddass_distr/1" xmlns:fn="http://www.w3.org/2006/xpath-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:sa_ref="http://xml.sandre.eaufrance.fr/scenario/referentiel/2" xmlns:axsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><axsl:output method="text" omit-xml-declaration="no" standalone="yes" indent="yes"/>
    <!--<axsl:variable name="chemin">http://195.220.97.105:8080/exist/xmldb/db/sandre/Referentiels/old_referentiel.xml</axsl:variable>--><axsl:variable name="cheminPAR">http://xml.sandre.eaufrance.fr/exist/sandre/Referentiels/PAR.xml</axsl:variable><axsl:variable name="cheminSUP">http://xml.sandre.eaufrance.fr/exist/sandre/Referentiels/SUP.xml</axsl:variable><axsl:template match="*|@*" mode="schematron-get-full-path"><axsl:apply-templates select="parent::*" mode="schematron-get-full-path"/><axsl:text>/</axsl:text><axsl:if test="count(. | ../@*) = count(../@*)">@</axsl:if><axsl:value-of select="name()"/><axsl:text>[</axsl:text><axsl:value-of select="1+count(preceding-sibling::*[name()=name(current())])"/><axsl:text>]</axsl:text></axsl:template><axsl:template match="/"><axsl:apply-templates select="/" mode="M1"/></axsl:template><axsl:key name="Echantillons" match="//xx:QUL_AEP/xx:Demande/xx:Prelevement" use="xx:Echantillon/xx:Laboratoire/xx:CdIntervenant/text()"/><axsl:key name="Prelevements" match="//xx:QUL_AEP/xx:Demande/xx:Prelevement" use="xx:CdPrelevement/text()"/><axsl:template match="//xx:QUL_AEP/xx:Demande/xx:Prelevement/xx:Echantillon[./xx:Laboratoire/xx:CdIntervenant/text()!=preceding-sibling::xx:Preleveur/xx:CdIntervenant/text()]" priority="4000" mode="M1"><axsl:choose><axsl:when test="count(./xx:Analyse/xx:InsituAna[./text()='1'])='0'"/><axsl:otherwise>E4.5/Lorsqu'un prélevement donne lieu a des mesures in situ et des analyses a realiser en laboratoire, si le preleveur est different du laboratoire, alors les mesures in situ DOIVENT etre 
regroupées dans un échantillon distinct, dont le laboratoire destinataire correspond au preleveur. Le prelevement erroné est'<axsl:value-of select="preceding-sibling::xx:CdPrelevement/text()"/>'.#</axsl:otherwise></axsl:choose><axsl:apply-templates mode="M1"/></axsl:template><axsl:template match="//xx:QUL_AEP/xx:Demande/xx:Prelevement" priority="4000" mode="M1"><axsl:choose><axsl:when test="count(./xx:Echantillon[./xx:Laboratoire/xx:CdIntervenant/text()=preceding-sibling::xx:Echantillon/xx:Laboratoire/xx:CdIntervenant]/xx:Laboratoire/xx:CdIntervenant/text())=0"/><axsl:otherwise>E4.7/Pour un prélèvement donné, il ne DOIT pas y avoir plus d'un échantillon adressé au meme laboratoire. Le prélevement erroné est celui réalisé sur la station '
			<axsl:value-of select="./xx:StationPrelevement/xx:CdStationPrelevement"/>' en date du '<axsl:value-of select="./xx:DatePrel"/>', et portant sur le support '<axsl:value-of select="./xx:Support/xx:CdSupport"/>' (<axsl:value-of select="document($cheminSUP)//sa_ref:Referentiel/sa_ref:Support[./sa_ref:CdSupport/text()=current()/xx:Support/xx:CdSupport]/sa_ref:LbSupport"/>).#</axsl:otherwise></axsl:choose><axsl:choose><axsl:when test="count(key('Prelevements',./xx:CdPrelevement))='1'"/><axsl:otherwise>E4.14/Plusieurs prélèvements ont le même code '<axsl:value-of select="./xx:CdPrelevement"/>'. Le code d'un prélevement DOIT etre unique.#</axsl:otherwise></axsl:choose><axsl:apply-templates mode="M1"/></axsl:template><axsl:template match="//xx:QUL_AEP/xx:Demande//*[name()='CdIntervenant']" priority="4000" mode="M1"><axsl:choose><axsl:when test="//xx:QUL_AEP/xx:Intervenant/xx:CdIntervenant/text()=current()"/><axsl:otherwise>E4.8/Tous les intervenants mis en jeu au sein d'un fichier DOIVENT être déclarés en amont du fichier. L'intervenant dont le code est '<axsl:value-of select="text()"/>' n'est pas déclaré.#</axsl:otherwise></axsl:choose><axsl:apply-templates mode="M1"/></axsl:template><axsl:template match="//xx:QUL_AEP/xx:StationPrelevement" priority="4000" mode="M1"><axsl:choose><axsl:when test="(not(./xx:CoordXStationPrelevement) and not(./xx:CoordYStationPrelevement) and not(./xx:ProjectStationPrelevement))or ((./xx:CoordXStationPrelevement) and (./xx:CoordYStationPrelevement) and (./xx:ProjectStationPrelevement)) "/><axsl:otherwise>E4.9/Toute coordonnée géographique mentionnée pour une station de prélevement 
DOIT être accompagnée du type de projection géographique. Les coordonnées géographiques de la station '<axsl:value-of select="./xx:CdStationPrelevement/text()"/>' (<axsl:value-of select="./xx:LbStationPrelevement/text()"/>) sont incomplètes.#</axsl:otherwise></axsl:choose><axsl:choose><axsl:when test="(not(./xx:AltitudeStationPrelevement) and not(./xx:ProjectAltiStationPrelevement)) or ((./xx:AltitudeStationPrelevement) and (./xx:ProjectAltiStationPrelevement)) "/><axsl:otherwise>E4.10/Toute coordonnée altimetrique mentionnée pour une station  de prélevement 
DOIT être accompagnée du type de projection altimétrique. Les coordonnées altimétriques de la station '<axsl:value-of select="./xx:CdStationPrelevement/text()"/>' (<axsl:value-of select="./xx:LbStationPrelevement/text()"/>) sont incomplètes.#</axsl:otherwise></axsl:choose><axsl:apply-templates mode="M1"/></axsl:template><axsl:template match="//xx:QUL_AEP/xx:StationPrelevement/xx:LocalPrelevement" priority="4000" mode="M1"><axsl:choose><axsl:when test="(not(./xx:CoordXLocalPrelevement) and not(./xx:CoordYLocalPrelevement) and not(./xx:ProjLocalPrelevement))or ((./xx:CoordXLocalPrelevement) and (./xx:CoordYLocalPrelevement) and (./xx:ProjLocalPrelevement)) "/><axsl:otherwise>E4.11/Toute coordonnée géographique mentionnée pour une localisation de prélevement 
DOIT être accompagnée du type de projection géographique. Les coordonnées géographiques de la localisation '<axsl:value-of select="./xx:CdLocalPrelevement/text()"/>' (<axsl:value-of select="./xx:LbLocalPrelevement/text()"/>) sont incomplètes.#</axsl:otherwise></axsl:choose><axsl:choose><axsl:when test="(not(./xx:ProjAltiLocalPrelevement) and not(./xx:AltMinLocalPrelevement) and not(./xx:AltMaxLocalPrelevement)) or ((./xx:ProjAltiLocalPrelevement) and (./xx:AltMinLocalPrelevement) and (./xx:AltMaxLocalPrelevement)) "/><axsl:otherwise>E4.12/Toute coordonnée altimétrique mentionnée pour une localisation  de prélevement 
DOIT être accompagnée du type de projection altimétrique. Les coordonnées altimétriques de la localisation '<axsl:value-of select="./xx:CdLocalPrelevement/text()"/>' (<axsl:value-of select="./xx:LbLocalPrelevement/text()"/>) sont incomplètes.#</axsl:otherwise></axsl:choose><axsl:apply-templates mode="M1"/></axsl:template><axsl:template match="//xx:QUL_AEP/xx:Demande/xx:DateDebutApplicationDemande" priority="4000" mode="M1"><axsl:variable name="AnneeDebut"><axsl:value-of select="substring(text(),1,4)"/></axsl:variable><axsl:variable name="MoisDebut"><axsl:value-of select="substring(text(),6,2)"/></axsl:variable><axsl:variable name="JourDebut"><axsl:value-of select="substring(text(),9,2)"/></axsl:variable><xsl:if test="//xx:QUL_AEP/xx:Demande/xx:DateFinApplicationDemande"><axsl:variable name="AnneeFin"><axsl:value-of select="substring(//xx:QUL_AEP/xx:Demande/xx:DateFinApplicationDemande,1,4)"/></axsl:variable><axsl:variable name="MoisFin"><axsl:value-of select="substring(//xx:QUL_AEP/xx:Demande/xx:DateFinApplicationDemande,6,2)"/></axsl:variable><axsl:variable name="JourFin"><axsl:value-of select="substring(//xx:QUL_AEP/xx:Demande/xx:DateFinApplicationDemande,9,2)"/></axsl:variable><axsl:choose><axsl:when test="($AnneeFin&gt;$AnneeDebut) or (($AnneeFin&gt;=$AnneeDebut) and ($MoisFin&gt;$MoisDebut)) or (($AnneeFin&gt;=$AnneeDebut) and ($MoisFin&gt;=$MoisDebut) and ($JourFin&gt;$JourDebut))"/><axsl:otherwise>E4.4/La date de début d'application de la demande DOIT être inférieure ou égale à la demande de fin d'application <axsl:value-of select="$AnneeDebut"/><axsl:value-of select="$MoisDebut"/><axsl:value-of select="$JourDebut"/>.#</axsl:otherwise></axsl:choose></xsl:if><axsl:apply-templates mode="M1"/></axsl:template><axsl:variable name="slash"><axsl:text>/</axsl:text></axsl:variable><axsl:template match="//xx:QUL_AEP/xx:Demande/xx:Prelevement/xx:CdPrelevement" priority="4000" mode="M1"><axsl:choose><axsl:when test="./@schemeAgencyID=//xx:QUL_AEP/xx:Intervenant/xx:CdIntervenant/text()"/><axsl:otherwise>E4.13/L'intervenant dont le code est '<axsl:value-of select="./@schemeAgencyID"/>', ayant codifié le prélevement '<axsl:value-of select="text()"/>' DOIT etre déclaré en amont du fichier d'échange.#</axsl:otherwise></axsl:choose><axsl:apply-templates mode="M1"/></axsl:template><axsl:template match="text()" priority="-1" mode="M1"/><axsl:template match="text()" priority="-1"/></axsl:stylesheet>