<xsl:element name="CollectivitesSPL" namespace="dgfip:collectivite.spl">
<xsl:element name="Collectivite" namespace="dgfip:collectivite.spl">
<xsl:for-each select="n:CollectivitesSPL/n:Collectivite/@*">
- <xsl:if test="not(name(.) eq 'archive')">
- <xsl:copy-of select="."/>
- </xsl:if>
- </xsl:for-each>
- <xsl:attribute name="archive" select="xem:getPresenceArchive(n:Exercice/text(),n:CollectivitesSPL/n:Collectivite/@idColl)"/>
+ <xsl:choose>
+ <xsl:when test="name(.) eq 'archive'"><xsl:attribute name="archive"><xsl:value-of select="xem:getPresenceArchive(//n:Exercice/text(),//n:CollectivitesSPL/n:Collectivite/@idColl)"/></xsl:attribute></xsl:when>
+ <xsl:when test="name(.) eq 'nature-controle'"><xsl:attribute name="nature-controle"><xsl:value-of select="normalize-space(.)"/></xsl:attribute></xsl:when>
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:if test="not(exists(//n:CollectivitesSPL/n:Collectivite/@nature-controle))"><xsl:attribute name="nature-controle">Inconnu</xsl:attribute></xsl:if>
</xsl:element>
</xsl:element>
</xsl:element>