- Timestamp:
- 09/16/15 12:22:18 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cats/ISOcat/trunk/mod-ISOcat-interface-rest/representations/dcs2/openskos.xsl
r5898 r6497 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <!-- 3 Copyright 2013 The Language Archive, Max Planck Institute for Psycholinguistics (MPIP)3 Copyright 2013-2015 The Language Archive, Max Planck Institute for Psycholinguistics (MPIP) 4 4 5 5 This code is part of ISOcat (www.isocat.org). … … 22 22 <xsl:param name="props"/> 23 23 <xsl:param name="approve" select="('CLARIN-NL/VL','Athens Core')"/> 24 <xsl:param name="do-uniq-notation" select="false()"/> 24 25 <xsl:variable name="doc" select="/"/> 25 26 <xsl:template match="text()"/> … … 29 30 <xsl:attribute name="xml:base" select="concat($base,'#')"/> 30 31 </xsl:if> 31 <openskos:skosCollection rdf:about="tmp:S-{replace(@owner,'\s','')}-{replace(@name,'\s','')}"> 32 <rdf:Description rdf:about="tmp:S-{replace(@owner,'\s','')}-{replace(@name,'\s','')}"> 33 <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Collection"/> 32 34 <dc:title> 33 35 <xsl:value-of select="@name"/> … … 36 38 <skos:member rdf:resource="tmp:C-{substring-after(@pid,'DC-')}"/> 37 39 </xsl:for-each> 38 </ openskos:skosCollection>40 </rdf:Description> 39 41 <xsl:for-each select="distinct-values(//dcif:profile)"> 40 42 <xsl:variable name="prof" select="."/> 41 <skos:ConceptScheme rdf:about="tmp:P-{replace(.,'\s','')}"> 43 <rdf:Description rdf:about="tmp:P-{replace(.,'\s','')}"> 44 <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#ConceptScheme"/> 42 45 <dc:title> 43 46 <xsl:value-of select="."/> … … 46 49 <skos:hasTopConcept rdf:resource="tmp:C-{substring-after(@pid,'DC-')}"/> 47 50 </xsl:for-each> 48 </ skos:ConceptScheme>51 </rdf:Description> 49 52 </xsl:for-each> 50 53 <xsl:apply-templates/> … … 52 55 </xsl:template> 53 56 <xsl:template match="dcif:dataCategory"> 57 <xsl:variable name="dc" select="."/> 58 <xsl:variable name="key" select="substring-after(@pid,'DC-')"/> 54 59 <xsl:variable name="name" select="@isocat:name"/> 55 60 <xsl:variable name="concept"> 56 <skos:Concept rdf:about="tmp:C-{substring-after(@pid,'DC-')}"> 61 <rdf:Description rdf:about="tmp:C-{$key}"> 62 <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Collection"/> 57 63 <!-- link back to the collection --> 58 64 <xsl:for-each select="ancestor::dcif:dataCategorySelection"> … … 93 99 <!-- xsl:for-each to change context, but there will be only one Administration Record --> 94 100 <xsl:for-each select="dcif:administrationInformationSection/dcif:administrationRecord"> 101 <xsl:variable name="id" select="dcif:identifier"/> 95 102 <skos:notation> 96 <xsl:value-of select="dcif:identifier"/> 103 <xsl:value-of select="$id"/> 104 <xsl:if test="$do-uniq-notation"> 105 <xsl:if test="exists($dc/preceding-sibling::dcif:dataCategory[dcif:administrationInformationSection/dcif:administrationRecord/dcif:identifier=$id])"> 106 <xsl:text>-</xsl:text> 107 <xsl:value-of select="$key"/> 108 </xsl:if> 109 </xsl:if> 97 110 </skos:notation> 111 <skos:altLabel> 112 <xsl:value-of select="$id"/> 113 </skos:altLabel> 98 114 </xsl:for-each> 99 115 … … 111 127 <xsl:for-each-group select="dcif:dataElementNameSection" group-by="dcif:dataElementName"> 112 128 <xsl:if test="normalize-space(current-grouping-key())!=''"> 113 <skos:notation>129 <skos:altLabel> 114 130 <xsl:value-of select="normalize-space(current-grouping-key())"/> 115 </skos: notation>131 </skos:altLabel> 116 132 </xsl:if> 117 133 </xsl:for-each-group> … … 129 145 --> 130 146 131 <xsl:for-each select="dcif:languageSection[dcif:language='en']"> 147 <skos:prefLabel xml:lang="en"> 148 <xsl:choose> 149 <xsl:when test="normalize-space($name)=''"> 150 <xsl:value-of select="normalize-space(ancestor::dcif:dataCategory/dcif:administrationInformationSection/dcif:administrationRecord/dcif:identifier)"/> 151 </xsl:when> 152 <xsl:otherwise> 153 <xsl:value-of select="normalize-space($name)"/> 154 </xsl:otherwise> 155 </xsl:choose> 156 </skos:prefLabel> 157 158 <xsl:for-each select="dcif:languageSection[dcif:language='en']"> 132 159 <xsl:variable name="lang" select="dcif:language"/> 133 134 <xsl:if test="$lang='en'">135 <skos:prefLabel xml:lang="{$lang}">136 <xsl:value-of select="normalize-space($name)"/>137 </skos:prefLabel>138 </xsl:if>139 160 140 161 <xsl:for-each-group select="dcif:nameSection[not($lang='en' and dcif:name=$name)]" group-by="dcif:nameStatus"> … … 228 249 --> 229 250 230 </ skos:Concept>251 </rdf:Description> 231 252 </xsl:variable> 232 253 <xsl:apply-templates select="$concept" mode="cleanup"/> … … 265 286 </xsl:if> 266 287 </xsl:template> 288 <xsl:template match="skos:Concept[normalize-space(skos:prefLabel)='']" mode="cleanup"> 289 <xsl:copy> 290 <xsl:apply-templates select="@*" mode="#current"/> 291 <skos:prefLabel xml:lang="en"> 292 <xsl:value-of select="skos:notation"/> 293 </skos:prefLabel> 294 <xsl:apply-templates select="node() except skos:prefLabel" mode="#current"/> 295 </xsl:copy> 296 </xsl:template> 267 297 </xsl:stylesheet>
Note: See TracChangeset
for help on using the changeset viewer.