source: cats/ISOcat/trunk/mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/xsl/DC2CDF.xsl @ 2710

Last change on this file since 2710 was 2710, checked in by mwindhouwer, 11 years ago

M mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/xml/dc.xml
M mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/components/ProfileValueDomainEditor.xml
M mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/xsl/Profiles2CDF.xsl
M mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/xsl/DC2CDF.xsl
M mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/js/org/isocat/gui/DCEditor.js
M mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/js/org/isocat/gui/ProfileValueDomainEditor.js
M mod-ISOcat-access-data/access/dc_check.xsl
M mod-ISOcat-access-data/access/dc_sql.xsl
M mod-ISOcat-access-data/dbms/ISOcat-schema-init.sql

  • renamed Private profile to 'undecided'
  • added 'not available' profile

M mod-ISOcat-site/site/index_files/news.html
M mod-ISOcat-site/pub/isocat.pub

  • keep track of the revision info
File size: 13.3 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet
3  xmlns:dcif="http://www.isocat.org/ns/dcif"
4  xmlns:isocat="http://www.isocat.org/"
5  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
6  version="1.0"
7>
8
9        <xsl:template match="text()"/>
10       
11        <xsl:template match="dcif:dataCategorySelection">
12                <data jsxid="jsxroot">
13                        <xsl:apply-templates/>
14                </data>
15        </xsl:template>
16       
17        <xsl:template match="dcif:dataCategory">
18                <record jsxid="dc-{@isocat:id}">
19                        <xsl:if test="@isocat:owner_id">
20                                <xsl:attribute name="owner">
21                                        <xsl:value-of select="@isocat:owner_id"/>
22                                </xsl:attribute>
23                        </xsl:if>
24                        <xsl:apply-templates select="dcif:administrationInformationSection"/>
25                        <xsl:apply-templates select="dcif:descriptionSection"/>
26                        <xsl:call-template name="conceptualdomains"/>
27                        <xsl:call-template name="linguisticsections"/>
28                        <xsl:apply-templates select="dcif:isA"/>
29                </record>
30        </xsl:template>
31       
32        <xsl:template match="dcif:administrationInformationSection/dcif:administrationRecord">
33                <record jsxid="admin" type="{ancestor::dcif:dataCategory/@isocat:type}">
34                        <xsl:call-template name="admin"/>
35                        <xsl:call-template name="admin-explanations"/>
36                        <xsl:call-template name="admin-issues"/>
37                        <xsl:call-template name="admin-changes"/>
38                        <xsl:apply-templates/>
39                </record>
40        </xsl:template>
41       
42        <xsl:template name="admin">
43                <xsl:for-each select="
44                    dcif:identifier
45                  | dcif:version
46                  | dcif:registrationStatus
47                  | isocat:administrationStatus
48                  | dcif:justification
49                  | dcif:origin
50                  | dcif:effectiveDate
51                  | dcif:untilDate
52                ">
53                        <xsl:attribute name="{local-name()}">
54                                <xsl:value-of select="."/>
55                        </xsl:attribute>
56                </xsl:for-each>
57        </xsl:template>
58
59        <xsl:template name="admin-explanations">
60                <record jsxid="explanations">
61                        <xsl:for-each select="dcif:explanatoryComment">
62                                <record jsxid="expl-{@isocat:id}" jsxtext="{.}"/>
63                        </xsl:for-each>
64                </record>
65        </xsl:template>
66
67        <xsl:template name="admin-issues">
68                <record jsxid="issues">
69                        <xsl:for-each select="dcif:unresolvedIssue">
70                                <record jsxid="issue-{@isocat:id}" jsxtext="{.}"/>
71                        </xsl:for-each>
72                </record>
73        </xsl:template>
74
75        <xsl:template name="admin-changes">
76                <record jsxid="changes">
77                        <xsl:for-each select="isocat:change">
78                                <record jsxid="change-{@isocat:id}" jsxtext="{.}" timestamp="{@timestamp}"/>
79                        </xsl:for-each>
80                </record>
81        </xsl:template>
82
83        <xsl:template match="dcif:descriptionSection">
84                <record jsxid="descr">
85                        <xsl:call-template name="descr-profiles"/>
86                        <xsl:call-template name="descr-datanames"/>
87                        <xsl:call-template name="descr-languagesections"/>
88                </record>
89        </xsl:template>
90
91        <xsl:template name="descr-profiles">
92                <record jsxid="profiles">
93                        <xsl:for-each select="dcif:profile">
94                                <record jsxid="profile-{@isocat:id}" jsxtext="{.}"/>                           
95                        </xsl:for-each>
96                </record>
97        </xsl:template>
98       
99        <xsl:template name="descr-datanames">
100                <record jsxid="datanames">
101                        <xsl:for-each select="dcif:dataElementNameSection">
102                                <record jsxid="dataname-{@isocat:id}" jsxtext="{dcif:dataElementName}" source="{dcif:source}"/>
103                        </xsl:for-each>
104                </record>
105        </xsl:template>
106       
107        <xsl:template name="descr-languagesections">
108                <record jsxid="languagesections">
109                        <xsl:for-each select="dcif:languageSection">
110                                <record jsxid="languagesection-{@isocat:id}" jsxtext="{dcif:language}" language="language-{dcif:language/@isocat:id}">
111                                        <xsl:call-template name="langsec-names">
112                                                <xsl:with-param name="lang" select="dcif:language"/>
113                                        </xsl:call-template>
114                                        <xsl:call-template name="langsec-definitions">
115                                                <xsl:with-param name="lang" select="dcif:language"/>
116                                        </xsl:call-template>
117                                        <xsl:call-template name="langsec-examples">
118                                                <xsl:with-param name="lang" select="dcif:language"/>
119                                        </xsl:call-template>
120                                        <xsl:call-template name="langsec-explanations">
121                                                <xsl:with-param name="lang" select="dcif:language"/>
122                                        </xsl:call-template>
123                                        <xsl:call-template name="langsec-notes">
124                                                <xsl:with-param name="lang" select="dcif:language"/>
125                                        </xsl:call-template>
126                                </record>
127                        </xsl:for-each>
128                </record>
129        </xsl:template>
130       
131        <xsl:template name="langsec-names">
132                <xsl:param name="lang"/>
133                <record jsxid="names-{$lang}">
134                        <xsl:for-each select="dcif:nameSection">
135                                <record jsxid="name-{@isocat:id}" jsxtext="{dcif:name}" status="{dcif:nameStatus}"/>
136                        </xsl:for-each>
137                </record>
138        </xsl:template>
139       
140        <xsl:template name="langsec-definitions">
141                <xsl:param name="lang"/>
142                <record jsxid="definitions-{$lang}">
143                        <xsl:for-each select="dcif:definitionSection">
144                                <record jsxid="definition-{@isocat:id}" jsxtext="{dcif:definition}" source="{dcif:source}" note="{dcif:note}"/>
145                        </xsl:for-each>
146                </record>
147        </xsl:template>
148       
149        <xsl:template name="langsec-examples">
150                <xsl:param name="lang"/>
151                <record jsxid="examples-{$lang}">
152                        <xsl:for-each select="dcif:exampleSection">
153                                <record jsxid="example-{@isocat:id}" jsxtext="{dcif:example}" source="{dcif:source}"/>
154                        </xsl:for-each>
155                </record>
156        </xsl:template>
157
158        <xsl:template name="langsec-explanations">
159                <xsl:param name="lang"/>
160                <record jsxid="explanations-{$lang}">
161                        <xsl:for-each select="dcif:explanationSection">
162                                <record jsxid="explanation-{@isocat:id}" jsxtext="{dcif:explanation}" source="{dcif:source}"/>
163                        </xsl:for-each>
164                </record>
165        </xsl:template>
166
167        <xsl:template name="langsec-notes">
168                <xsl:param name="lang"/>
169                <record jsxid="notes-{$lang}">
170                        <xsl:for-each select="dcif:note">
171                                <record jsxid="note-{@isocat:id}" jsxtext="{.}"/>
172                        </xsl:for-each>
173                </record>
174        </xsl:template>
175       
176        <xsl:key name="values" match="dcif:value" use="@isocat:id"/>
177       
178        <xsl:template name="conceptualdomains">
179                <xsl:variable name="type" select="(dcif:conceptualDomain/@type)[1]"/>
180                <record jsxid="conceptualdomain" type="{$type}">
181                        <!-- open, closed and constrained -->
182                        <xsl:variable name="dataType" select="(dcif:conceptualDomain/dcif:dataType)[1]"/>
183                        <xsl:if test="$dataType">
184                                <xsl:attribute name="datatype">
185                                        <xsl:value-of select="$dataType"/>
186                                </xsl:attribute>
187                                <xsl:attribute name="datatype-id">
188                                        <xsl:text>datatype-</xsl:text>
189                                        <xsl:value-of select="$dataType/@isocat:id"/>
190                                </xsl:attribute>
191                        </xsl:if>
192                        <!-- open -->
193                        <xsl:if test="$type='open'">
194                                <xsl:attribute name="cd-id">
195                                        <xsl:value-of select="(dcif:conceptualDomain/@isocat:id)[1]"/>
196                                </xsl:attribute>
197                        </xsl:if>
198                        <!-- closed -->
199                        <xsl:for-each select="dcif:conceptualDomain/dcif:value[count(. | key('values', @isocat:id)[1]) = 1]">
200                                <xsl:variable name="val" select="current()"/>
201                                <record jsxid="conceptualdomain-value-{$val/@isocat:id}" jsxtext="{$val/@isocat:name}" name="{$val/@isocat:name}" identifier="{$val/@isocat:identifier}">
202                                        <xsl:for-each select="isocat:profile">
203                                                <xsl:variable name="prof" select="current()"/>
204                                                <xsl:attribute name="profile-{$prof/@isocat:id}-name">
205                                                        <xsl:value-of select="$prof"/>
206                                                </xsl:attribute>
207                                                <xsl:variable name="cd" select="key('values',$val/@isocat:id)/parent::dcif:conceptualDomain[parent::dcif:dataCategory][dcif:profile/@isocat:id=$prof/@isocat:id]"/>
208                                                <xsl:choose>
209                                                        <xsl:when test="$cd">
210                                                                <xsl:attribute name="profile-{$prof/@isocat:id}">1</xsl:attribute>
211                                                                <xsl:attribute name="profile-{$prof/@isocat:id}-cd">
212                                                                        <xsl:value-of select="$cd/@isocat:id"/>
213                                                                </xsl:attribute>
214                                                        </xsl:when>
215                                                        <xsl:otherwise>
216                                                                <xsl:attribute name="profile-{$prof/@isocat:id}">0</xsl:attribute>
217                                                        </xsl:otherwise>
218                                                </xsl:choose>
219                                        </xsl:for-each>
220                                        <!-- special for profile- -1, i.e., the unavailable profile: the DC might be in the unavailable profile value domain, although it isn't a member of the unavailable profile -->
221                                        <xsl:choose>
222                                                <xsl:when test="isocat:profile[@isocat:id='-1']">
223                                                        <!-- don't do anything, handled above -->
224                                                        <xsl:message>simple DC is a member of the 'not available' profile</xsl:message>
225                                                </xsl:when>
226                                                <xsl:when test="key('values',$val/@isocat:id)/parent::dcif:conceptualDomain[parent::dcif:dataCategory][dcif:profile/@isocat:id='-1']">
227                                                        <!-- part of the unavailable profile value domain -->
228                                                        <xsl:message>simple DC is part of the 'not available' profile value domain</xsl:message>
229                                                        <xsl:attribute name="profile--1">1</xsl:attribute>
230                                                        <xsl:attribute name="profile--1-name">
231                                                                <xsl:text>not available</xsl:text>
232                                                        </xsl:attribute>
233                                                        <xsl:attribute name="profile--1-cd">
234                                                                <xsl:value-of select="key('values',$val/@isocat:id)/parent::dcif:conceptualDomain[parent::dcif:dataCategory][dcif:profile/@isocat:id='-1']/@isocat:id"/>
235                                                        </xsl:attribute>
236                                                </xsl:when>
237                                                <!-- there is no unavailable profile value domain, and the simple DC isn't a member of the unavailable profile --> 
238                                        </xsl:choose>
239                                        <!-- special for profile-0, i.e., the undecided profile: the DC might be in the undecided profile value domain, although it isn't a member of the undecided profile -->
240                                        <xsl:choose>
241                                                <xsl:when test="isocat:profile[@isocat:id='0']">
242                                                        <!-- don't do anything, handled above -->
243                                                        <xsl:message>simple DC is a member of the 'undecided' profile</xsl:message>
244                                                </xsl:when>
245                                                <xsl:when test="key('values',$val/@isocat:id)/parent::dcif:conceptualDomain[parent::dcif:dataCategory][dcif:profile/@isocat:id='0']">
246                                                        <!-- part of the private profile value domain -->
247                                                        <xsl:message>simple DC is part of the 'undecided' profile value domain</xsl:message>
248                                                        <xsl:attribute name="profile-0">1</xsl:attribute>
249                                                        <xsl:attribute name="profile-0-name">
250                                                                <xsl:text>undecided</xsl:text>
251                                                        </xsl:attribute>
252                                                        <xsl:attribute name="profile-0-cd">
253                                                                <xsl:value-of select="key('values',$val/@isocat:id)/parent::dcif:conceptualDomain[parent::dcif:dataCategory][dcif:profile/@isocat:id='0']/@isocat:id"/>
254                                                        </xsl:attribute>
255                                                </xsl:when>
256                                                <!-- there is no undecided profile value domain, and the simple DC isn't a member of the undecided profile --> 
257                                        </xsl:choose>
258                                </record>
259                        </xsl:for-each>
260                        <!-- constrained -->
261                        <xsl:for-each select="dcif:conceptualDomain/dcif:rule">
262                                <!-- keep also track of the conceptual domain id -->
263                                <record jsxid="conceptualdomain-rule-{@isocat:id}" rule-type="{../dcif:ruleType}" rule-type-id="rule-type-{../dcif:ruleType/@isocat:id}" cd-id="cd-{parent::dcif:conceptualDomain/@isocat:id}" jsxtext="{.}"/>
264                        </xsl:for-each>
265                </record>
266        </xsl:template>
267
268        <xsl:template match="dcif:isA">
269                <record jsxid="is-a" id="{@isocat:id}" jsxtext="{@isocat:name}" name="{@isocat:name}" identifier="{@isocat:identifier}"/>
270        </xsl:template> 
271
272        <xsl:template name="linguisticsections">
273                <record jsxid="linguisticsections">
274                        <xsl:for-each select="dcif:linguisticSection">
275                                <record jsxid="linguisticsection-{@isocat:id}" jsxtext="{dcif:language}" language="language-{dcif:language/@isocat:id}" type="{@type}">
276                                        <xsl:call-template name="lingsec-examples">
277                                                <xsl:with-param name="lang" select="dcif:language"/>
278                                        </xsl:call-template>
279                                        <xsl:call-template name="lingsec-explanations">
280                                                <xsl:with-param name="lang" select="dcif:language"/>
281                                        </xsl:call-template>
282                                        <xsl:call-template name="lingsec-notes">
283                                                <xsl:with-param name="lang" select="dcif:language"/>
284                                        </xsl:call-template>
285                                        <xsl:call-template name="lingsec-conceptualdomains">
286                                                <xsl:with-param name="lang" select="dcif:language"/>
287                                        </xsl:call-template>
288                                </record>
289                        </xsl:for-each>
290                </record>
291        </xsl:template>
292
293        <xsl:template name="lingsec-examples">
294                <xsl:param name="lang"/>
295                <record jsxid="lingsec-examples-{$lang}">
296                        <xsl:for-each select="dcif:exampleSection">
297                                <record jsxid="example-{@isocat:id}" jsxtext="{dcif:example}" source="{dcif:source}"/>
298                        </xsl:for-each>
299                </record>
300        </xsl:template>
301       
302        <xsl:template name="lingsec-explanations">
303                <xsl:param name="lang"/>
304                <record jsxid="lingsec-explanations-{$lang}">
305                        <xsl:for-each select="dcif:explanationSection">
306                                <record jsxid="explanation-{@isocat:id}" jsxtext="{dcif:explanation}" source="{dcif:source}"/>
307                        </xsl:for-each>
308                </record>
309        </xsl:template>
310       
311        <xsl:template name="lingsec-notes">
312                <xsl:param name="lang"/>
313                <record jsxid="lingsec-notes-{$lang}">
314                        <xsl:for-each select="dcif:note">
315                                <record jsxid="note-{@isocat:id}" jsxtext="{.}"/>
316                        </xsl:for-each>
317                </record>
318        </xsl:template>
319       
320        <xsl:template name="lingsec-conceptualdomains">
321                <xsl:param name="lang"/>
322                <xsl:variable name="type" select="(dcif:conceptualDomain/@type)[1]"/>
323                <record jsxid="lingsec-conceptualdomain-{$lang}" type="{$type}">
324                        <!-- closed -->
325                        <xsl:for-each select="dcif:conceptualDomain/dcif:value">
326                                <record jsxid="lingsec-conceptualdomain-{$lang}-value-{@isocat:id}"  cd-id="cd-{parent::dcif:conceptualDomain/@isocat:id}" jsxtext="{@isocat:name}" name="{@isocat:name}" identifier="{@isocat:identifier}"/>
327                        </xsl:for-each>
328                        <!-- constrained -->
329                        <xsl:for-each select="dcif:conceptualDomain/dcif:rule">
330                                <record jsxid="lingsec-conceptualdomain-{$lang}-rule-{@isocat:id}" rule-type="{../dcif:ruleType}" rule-type-id="rule-type-{../dcif:ruleType/@isocat:id}" cd-id="cd-{parent::dcif:conceptualDomain/@isocat:id}" jsxtext="{.}"/>
331                        </xsl:for-each>
332                </record>
333        </xsl:template>
334       
335</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.