Newer
Older
web-services / loterre-xslt / v1 / register / Attribution_Identifiants_ark.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"    
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
    xmlns:cc="http://creativecommons.org/ns#" 
    xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#"
    xmlns:exslt="http://exslt.org/common"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:isothes="http://purl.org/iso25964/skos-thes#"
    xmlns:wdt="https://www.wikidata.org/wiki/Property:" 
    xmlns:lexinfo="http://www.lexinfo.net/ontology/2.0/lexinfo#" 
  xmlns:obo="http://purl.obolibrary.org/obo/" 
  xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" 
  xmlns:gn="https://www.geonames.org/ontology#" 
  xmlns:dcterms="http://purl.org/dc/terms/" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#" 
  xmlns:gvp="http://vocab.getty.edu/ontology#" 
  xmlns:inist="http://www.inist.fr/Ontology#"
    exclude-result-prefixes="exslt ">
  
     
    <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no"  indent="yes"/>
    <!-- =================================================================
        Recalcul des relations internes (broader, narrower, related, member) pour un fichier SKOS dont les concpets ont reçu un identifiant ark généré à l'aide d'un webservice ad hoc.
        Les concepts cumulent un attribut" rdf:about" contenant l'uri d'origine et un attribut "xml:lid" contenant l'identifiant ark.
        Si l'ancien identifiant est déjà un ark, il est gardé tel quel.-->
         
    <!--ancien uri de la ressource-->
     <xsl:variable name="ancienPrefixe">
        <xsl:choose>
            <xsl:when test="//skos:ConceptScheme">
                <xsl:value-of select="//skos:ConceptScheme/@rdf:about"/>
            </xsl:when>
            <xsl:when test="//rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]">
                <xsl:value-of select="//rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]/@rdf:about"/>
            </xsl:when>
            <xsl:when test="//owl:Ontology[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]">
                <xsl:value-of select="//owl:Ontology[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]/@rdf:about"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="//skos:Concept[1]/skos:inScheme/@rdf:resource"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    
    <xsl:variable name="uriArkLoterre" select="'[A-Z0-9]{{3}}-[A-Z0-9]{{8}}-[A-Z0-9]'" />
    
    <!-- partie fixe de l'identifiant des concepts : si la ressource est une ressource Loterre, on garde l'uri actuel ; dna le cas contraire, on génère un préfixe à modifier ultérieurement par l'utilisateur-->
    <xsl:variable name="nouveauPrefixe">
        <xsl:choose>
            <xsl:when test="matches(//skos:ConceptScheme/@rdf:about, 'http://data.loterre.fr/ark:/67375/[A-Z0-9]{3}')"><!--syntaxe de l'identifiant ark Loterre-->
                <xsl:value-of select="//skos:ConceptScheme/@rdf:about"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="'http://mon_site.fr/ark:/NAAN/ABC'"/>
<!--                <xsl:value-of select="'http://data.loterre.fr/ark:/67375/8HQ'"/>-->
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
   

    <!--================================================================
        rdf:RDF
        =================================================================-->
    
    <xsl:template match="rdf:RDF">
        <!-- variable pour stocker le résultat du traitement qui sera réutilisé pour calculer les relations TA, TG-->
        <xsl:variable name="ARK">
            <ark>
                <xsl:copy-of select="namespace::*"/>
                <rdf:RDF>

                        <cc:License rdf:about="http://creativecommons.org/licenses/by/4.0/">
                            <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/>
                            <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
                            <dc:title xml:lang="en">Attribution 4.0 International</dc:title>
                            <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
                            <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
                            <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/>
                        </cc:License>
                        <xsl:choose>
                            <xsl:when test="skos:ConceptScheme">
                                <skos:ConceptScheme>
                                    <xsl:attribute name="rdf:about">
                                         <xsl:value-of select="$nouveauPrefixe"/>
                                    </xsl:attribute>
<!--                                    <xsl:copy-of select="skos:ConceptScheme/*"/>-->
                                    <xsl:for-each select="skos:ConceptScheme/*">
                                        <xsl:element name="{name()}">
                                            <xsl:copy-of select="@*"/>
                                            <xsl:value-of select="normalize-space(.)"/>
                                        </xsl:element>
                                    </xsl:for-each>
                                    <!-- ancien identifiant -->
                                    <dc:identifier>
                                        <xsl:value-of select="$ancienPrefixe"/>
                                    </dc:identifier> 
                                </skos:ConceptScheme>
                            </xsl:when>
                            <xsl:when test="rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]">
                                <rdf:Description>
                                    <xsl:attribute name="rdf:about">
                                        <xsl:value-of select="$nouveauPrefixe"/>
                                    </xsl:attribute>
                                    <xsl:for-each select="rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]/*">
                                        <xsl:element name="{name()}">
                                            <xsl:copy-of select="@*"/>
                                            <xsl:value-of select="normalize-space(.)"/>
                                        </xsl:element>
                                    </xsl:for-each>
                                     <!-- ancien identifiant -->
                                    <dc:identifier>
                                        <xsl:value-of select="$ancienPrefixe"/>
                                    </dc:identifier> 
                                </rdf:Description>
                            </xsl:when>
                        </xsl:choose>
 
                        <xsl:apply-templates select="skos:Concept |rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']] "/>                         
                        <xsl:apply-templates select="skos:Collection | isothes:ConceptGroup |rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Collection' or @rdf:resource='http://purl.org/iso25964/skos-thes#ConceptGroup']]"/>
                        <xsl:apply-templates select="skosxl:Label |rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2008/05/skos-xl#Label']] "/>
                   </rdf:RDF>
            </ark>
        </xsl:variable>
        <!-- on reparcourt tout le fichier résultat de la première transformation pour recalculer les TA, TG, TS, skos:member -->
        <xsl:apply-templates select="exslt:node-set($ARK)/ark"/>
    </xsl:template>
          
    <!--=================================================================
    skos:Concept
    ===================================================================-->
    <xsl:template match="skos:Concept | rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']]">
        <xsl:element name="{name()}">
                 <xsl:attribute name="rdf:about"> 
                          <xsl:value-of select="@uri"/>
                 </xsl:attribute>
            
            <xsl:copy-of select="rdf:type"/>

            <!--on recopie tout sauf inScheme et les skosxl-->
            <xsl:for-each select="./*">
                <xsl:choose>
                    <xsl:when test="name(.)='skos:inScheme' or name(.)='skosxl:prefLabel' or name(.)='skosxl:altLabel' or name(.)='skosxl:hiddenLabel' ">
                    </xsl:when>
                    <xsl:otherwise>
<!--                        <xsl:copy-of select="."/>-->
                        <xsl:element name="{name()}">
                            <xsl:copy-of select="@*"/>
                            <xsl:value-of select="normalize-space(.)"/>
                        </xsl:element>
                     </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
            <skos:inScheme>
                <xsl:attribute name="rdf:resource">
                     <xsl:value-of select="$nouveauPrefixe"/>  
                </xsl:attribute>
            </skos:inScheme>
            <xsl:for-each select="skosxl:prefLabel">
                <skosxl:prefLabel>
                    <xsl:attribute name="rdf:resource">
                        <xsl:choose>
                            <xsl:when test="contains(@rdf:resource, $ancienPrefixe)">
                                <xsl:call-template name="replace">
                                    <xsl:with-param name="uri" select="@rdf:resource"/>
                                    <xsl:with-param name="replace" select="$ancienPrefixe"/>
                                    <xsl:with-param name="by" select="$nouveauPrefixe"/>
                                  </xsl:call-template>
                        </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>
                </skosxl:prefLabel>
            </xsl:for-each>
            <xsl:for-each select="skosxl:altLabel">
                <skosxl:altLabel>
                    <xsl:attribute name="rdf:resource">
                        <xsl:choose>
                            <xsl:when test="contains(@rdf:resource, $ancienPrefixe)">
                                <xsl:call-template name="replace">
                                    <xsl:with-param name="uri" select="@rdf:resource"/>
                                    <xsl:with-param name="replace" select="$ancienPrefixe"/>
                                    <xsl:with-param name="by" select="$nouveauPrefixe"/>
                                </xsl:call-template>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>
                </skosxl:altLabel>
            </xsl:for-each>
            <xsl:for-each select="skosxl:hiddenLabel">
                <skosxl:hiddenLabel>
                    <xsl:attribute name="rdf:resource">
                        <xsl:choose>
                            <xsl:when test="contains(@rdf:resource, $ancienPrefixe)">
                                <xsl:call-template name="replace">
                                    <xsl:with-param name="uri" select="@rdf:resource"/>
                                    <xsl:with-param name="replace" select="$ancienPrefixe"/>
                                    <xsl:with-param name="by" select="$nouveauPrefixe"/>
                                </xsl:call-template>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>
                </skosxl:hiddenLabel>
            </xsl:for-each>
            <!--ancien uri-->
                    <dc:identifier>
                        <xsl:value-of select="@rdf:about"/>
                    </dc:identifier>
 
           
        </xsl:element>
    </xsl:template>
       
        
    <!--=================================================================
    skos:Collection
    ===================================================================-->
    <xsl:template match="skos:Collection | isothes:ConceptGroup | rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Collection' or @rdf:resource='http://purl.org/iso25964/skos-thes#ConceptGroup']] ">
        <xsl:element name="{name()}">
            <xsl:attribute name="rdf:about">
                <xsl:value-of select="concat($nouveauPrefixe,'-',substring-after(@rdf:about, concat($ancienPrefixe,'/')))"/>
                <!--xsl:value-of select="@rdf:about"/-->
            </xsl:attribute>
            <xsl:copy-of select="rdf:type"/>
            <skos:inScheme>
                <xsl:attribute name="rdf:resource">
  
                    <xsl:value-of select="$nouveauPrefixe"/>
                </xsl:attribute>
            </skos:inScheme>
            <xsl:copy-of select="skos:prefLabel"/>
            <xsl:copy-of select="skos:altLabel"/>
            <xsl:for-each select="isothes:superGroup">
                <isothes:superGroup>
                    <xsl:attribute name="rdf:resource">
                        <!--xsl:value-of select="substring-after(@rdf:resource, '/vocabs/')"/-->
                        <xsl:value-of select="concat($nouveauPrefixe,'-',substring-after(@rdf:resource, concat($ancienPrefixe,'/')))"/>
                    </xsl:attribute>
                </isothes:superGroup>
            </xsl:for-each>
            <xsl:for-each select="isothes:subGroup">
                <isothes:subGroup>
                    <xsl:attribute name="rdf:resource">
                        <!--xsl:value-of select="substring-after(@rdf:resource, '/vocabs/')"/-->
                        <xsl:value-of select="concat($nouveauPrefixe,'-',substring-after(@rdf:resource, concat($ancienPrefixe,'/')))"/>
                    </xsl:attribute>
                </isothes:subGroup>
            </xsl:for-each>
            <xsl:copy-of select="skos:member"/>
            <xsl:copy-of select="rdfs:comment"/>
        </xsl:element>
    </xsl:template>
   
    <!--
        ==================================================================
        recalcul TA-TG
        ==================================================================
        -->
    <xsl:template match="ark">
        <rdf:RDF>
            <!-- récupérer les name spaces du document traité dans la racine du fichier résultat -->
            <xsl:copy-of select="namespace::*"/>
            <cc:License>
                <xsl:copy-of select="rdf:RDF/cc:License/@*"/>
                <xsl:copy-of select="rdf:RDF/cc:License/*"/>
            </cc:License>
            <xsl:apply-templates select="rdf:RDF/skos:ConceptScheme | rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]"/>
            
            <!--contrôle d'unicité de l'identifiant ark-->
            <xsl:choose>
                <xsl:when test="not(rdf:RDF/skos:Concept[@rdf:about=preceding::rdf:RDF/skos:Concept/@rdf:about] or rdf:RDF/skos:Concept[@rdf:about=following::rdf:RDF/skos:Concept/@rdf:about]
                    or rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept'] and @rdf:about=preceding::rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']]/@rdf:about] 
                    or rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept'] and @rdf:about=following::rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']]/@rdf:about]) ">
                    <xsl:apply-templates select="rdf:RDF/skos:Concept | rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']]" mode="recalcul"/>
                    <xsl:copy-of select="rdf:RDF/skosxl:Label | rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2008/05/skos-xl#Label']]"/>
                    <xsl:apply-templates select="rdf:RDF/skos:Collection | rdf:RDF/isothes:ConceptGroup | rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Collection' or @rdf:resource='http://purl.org/iso25964/skos-thes#ConceptGroup']]" mode ="recalcul"/>
                </xsl:when>
                <xsl:otherwise>
                    <alerte>Doublon au niveau des arks</alerte>
                </xsl:otherwise>
            </xsl:choose>
        </rdf:RDF>
    </xsl:template>
    <!-- =================================================================
skos:ConceptScheme
===================================================================== -->   
    <xsl:template match="skos:ConceptScheme | rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#ConceptScheme']]">
        <xsl:element name="{name()}">
            <xsl:copy-of select="@rdf:about"/>
            <!--on recopie tout sauf la relation hasTopConcept-->
            <xsl:for-each select="./*">
                <xsl:choose>
                    <xsl:when test="name(.)='skos:hasTopConcept'">
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="."/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
            <xsl:for-each select="skos:hasTopConcept">
                <skos:hasTopConcept>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                </skos:hasTopConcept>
            </xsl:for-each>
          
        </xsl:element>
    </xsl:template>
  
    <!-- =================================================================
skos:Concept
===================================================================== -->  
    <xsl:template match="rdf:RDF/skos:Concept | rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']]" mode ="recalcul">
        <xsl:element name="{name()}">
                 <xsl:copy-of select="@rdf:about"/>
                <!--on recopie tout sauf les relations-->
            <xsl:for-each select="./*[not(name(.)=('dc:identifier','skos:broader','skos:related','skos:narrower', 'isothes:broaderPartitive', 'isothes:narrowerPartitive',  'isothes:broaderInstantial', 'isothes:narrowerInstantial'))]">
                              <xsl:copy-of select="."/>
                </xsl:for-each>

            <xsl:for-each select="skos:broader">
                <xsl:variable name="verbalisation" select="."/>
                <skos:broader>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                    <!--                    <xsl:copy-of select="$verbalisation"/>-->
                </skos:broader>
            </xsl:for-each>
            <xsl:for-each select="skos:narrower">
                <skos:narrower>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                </skos:narrower>
            </xsl:for-each>
            <xsl:for-each select="isothes:broaderPartitive">
                <xsl:variable name="verbalisation" select="."/>
                <isothes:broaderPartitive>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                    <!--                    <xsl:copy-of select="$verbalisation"/>-->
                </isothes:broaderPartitive>
            </xsl:for-each>
            <xsl:for-each select="isothes:narrowerPartitive">
                <isothes:narrowerPartitive>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                </isothes:narrowerPartitive>
            </xsl:for-each>
            <xsl:for-each select="isothes:broaderInstantial">
                <xsl:variable name="verbalisation" select="."/>
                <isothes:broaderInstantial>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                    <!--                    <xsl:copy-of select="$verbalisation"/>-->
                </isothes:broaderInstantial>
            </xsl:for-each>
            <xsl:for-each select="isothes:narrowerInstantial">
                <isothes:narrowerInstantial>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                </isothes:narrowerInstantial>
            </xsl:for-each>
            <xsl:for-each select="skos:related">
                <skos:related>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                </skos:related>
            </xsl:for-each> 
                      
            <xsl:copy-of select="comment()"/>
        </xsl:element>
    </xsl:template>
   
    <!-- 
        ========================================================
        Remplacement uri par ark 
    ==========================================================
    -->
    <xsl:template name="ark">
        <xsl:param name="resource"/>
        <xsl:choose>
            <xsl:when test="//skos:Concept[dc:identifier=$resource]">
                <xsl:value-of select="//skos:Concept[dc:identifier=$resource]/@rdf:about"/>
            </xsl:when>
            <xsl:when test="//rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept'] and dc:identifier=$resource]">
                <xsl:value-of select="//rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept'] and dc:identifier=$resource]/@rdf:about"/>
            </xsl:when>
        </xsl:choose>
    </xsl:template>
    
     <!-- 
         =================================================================
skos:Collection
===================================================================== --> 
    <xsl:template match="rdf:RDF/skos:Collection | rdf:RDF/isothes:ConceptGroup | rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Collection' or @rdf:resource='http://purl.org/iso25964/skos-thes#ConceptGroup' ]]" mode ="recalcul">
        <xsl:element name="{name()}">
            <xsl:copy-of select="@rdf:about"/>
            <!--on recopie tout sauf les relations-->
            <xsl:for-each select="./*">
                <xsl:choose>
                    <xsl:when test="name(.)='skos:member'">
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="."/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>

            <xsl:for-each select="skos:member">
                <skos:member>
                    <xsl:attribute name="rdf:resource">
                        <xsl:call-template name="ark2">
                            <xsl:with-param name="resource">
                                <xsl:value-of select="@rdf:resource"/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:attribute>
                </skos:member>
            </xsl:for-each>

        </xsl:element>
        
    </xsl:template>
  
    <!--
        =============================================================
        Remplacement uri skos:member par ark si existant 
    ==============================================================-->
    <xsl:template name="ark2">
        <xsl:param name="resource"/>
        <xsl:choose>
            <xsl:when test="//skos:Concept[dc:identifier=$resource]">
                <xsl:value-of select="//skos:Concept[dc:identifier=$resource]/@rdf:about"/>
            </xsl:when>
            <xsl:when test="//rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept'] and dc:identifier=$resource]">
                <xsl:value-of select="//rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept'] and dc:identifier=$resource]/@rdf:about"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$resource"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>  
    <!--
        =============================================================
        Remplacement uri skosxl
    ==============================================================-->  
    <xsl:template name="replace">
        <xsl:param name="uri"/>
        <xsl:param name="replace"/>
        <xsl:param name="by"/>
        <xsl:choose>
            <xsl:when test="contains($uri, $replace)">
                <xsl:value-of select="substring-before($uri,$replace)"/>
                <xsl:value-of select="$by"/>
                <xsl:value-of select="substring-after($uri,$replace)"/>
            </xsl:when>
        </xsl:choose>
    </xsl:template>
    <!--
        =============================================================
  skosxl:Label
    ==============================================================-->
    <xsl:template match="skosxl:Label | rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2008/05/skos-xl#Label']]">
        <xsl:element name="{name()}">
            <xsl:attribute name="rdf:about">
                <xsl:choose>
                    <xsl:when test="contains(@rdf:about, $ancienPrefixe)">
                        <xsl:call-template name="replace">
                            <xsl:with-param name="uri" select="@rdf:about"/>
                            <xsl:with-param name="replace" select="$ancienPrefixe"/>
                            <xsl:with-param name="by" select="$nouveauPrefixe"/>
                        </xsl:call-template>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="@rdf:about"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
            <xsl:copy-of select="./*"/>
        </xsl:element>
    </xsl:template>
   
</xsl:stylesheet>