forked from A-Menu/DM-EAD-TNAH-2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Index.xsl
82 lines (74 loc) · 2.65 KB
/
Index.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:variable name="Paris">
<xsl:text>Paris</xsl:text>
</xsl:variable>
<xsl:template match="/">
<controlaccess>
<xsl:apply-templates mode="dpt"/>
<xsl:apply-templates mode="cmn"/>
<xsl:apply-templates mode="mh_non-Paris"/>
<xsl:apply-templates mode="mh_Paris"/>
</controlaccess>
</xsl:template>
<xsl:template match="@* | node()" mode="#all">
<xsl:apply-templates mode="#current"/>
</xsl:template>
<xsl:template match="departement[@id]" mode="dpt">
<geogname>
<xsl:attribute name="authfilenumber">
<xsl:value-of select="./@id"/>
</xsl:attribute>
<xsl:attribute name="source">
<xsl:text>FRAN_RI_005</xsl:text>
</xsl:attribute>
<xsl:value-of select="./nom/text()"/>
</geogname>
</xsl:template>
<xsl:template match="commune[@id]" mode="cmn">
<geogname>
<xsl:attribute name="authfilenumber">
<xsl:value-of select="./@id"/>
</xsl:attribute>
<xsl:attribute name="source">
<xsl:text>FRAN_RI_005</xsl:text>
</xsl:attribute>
<xsl:value-of select="./nom/text()"/>
</geogname>
</xsl:template>
<xsl:template match="mh[preceding-sibling::nom/text()!=$Paris][@id]" mode="mh_non-Paris">
<geogname>
<xsl:variable name="NA">
<xsl:text>NA</xsl:text>
</xsl:variable>
<xsl:if test="./@id!=$NA">
<xsl:attribute name="authfilenumber">
<xsl:value-of select="./@id"/>
</xsl:attribute>
<xsl:attribute name="source">
<xsl:text>FRAN_RI_005</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="./text()"/>
</geogname>
</xsl:template>
<xsl:template match="mh[preceding-sibling::nom/text()=$Paris][@id]" mode="mh_Paris">
<geogname>
<xsl:variable name="NA">
<xsl:text>NA</xsl:text>
</xsl:variable>
<xsl:if test="./@id!=$NA">
<xsl:attribute name="authfilenumber">
<xsl:value-of select="./@id"/>
</xsl:attribute>
<xsl:attribute name="source">
<xsl:text>FRAN_RI_026</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="./text()"/>
</geogname>
</xsl:template>
</xsl:stylesheet>