Changeset 829 for metadata


Ignore:
Timestamp:
11/02/10 10:36:32 (14 years ago)
Author:
dietuyt
Message:

Fix to match elements from OLAC 1.1 as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • metadata/trunk/toolkit/xslt/olac2cmdi.xsl

    r818 r829  
    22<xsl:stylesheet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    33    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
    4     xmlns:dc="http://purl.org/dc/elements/1.1/"
     4    xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"
    55    xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
    66    xmlns:defns="http://www.openarchives.org/OAI/2.0/"
    77    xmlns:olac="http://www.language-archives.org/OLAC/1.0/"
     8    xmlns:olac11="http://www.language-archives.org/OLAC/1.1/"
    89    xsi:schemaLocation="    http://purl.org/dc/elements/1.1/    http://www.language-archives.org/OLAC/1.0/dc.xsd    http://purl.org/dc/terms/    http://www.language-archives.org/OLAC/1.0/dcterms.xsd    http://www.language-archives.org/OLAC/1.0/    http://www.language-archives.org/OLAC/1.0/olac.xsd    http://www.language-archives.org/OLAC/1.0/third-party/software.xsd ">
    910
     
    1213    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    1314
    14     <!-- identity copy -->
    15 <!--    <xsl:template match="@*|node()">
    16         <xsl:copy>
    17             <xsl:apply-templates select="@*|node()"/>
    18         </xsl:copy>
    19     </xsl:template>
    20 -->
    21    
    2215    <xsl:template match="/">
    2316        <CMD
    24             xsi:schemaLocation="http://www.clarin.eu/cmd http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1271859438236/xsd">
     17            xsi:schemaLocation="http://www.clarin.eu/cmd http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1288172614026/xsd">
    2518            <Header>
    2619                <MdCreator>olac2cmdi.xsl</MdCreator>
     
    4134                    <xsl:value-of select="//defns:identifier"/>
    4235                </MdSelfLink>
    43                 <MdProfile>clarin.eu:cr1:p_1271859438236</MdProfile>
     36                <MdProfile>clarin.eu:cr1:p_1288172614026</MdProfile>
    4437            </Header>
    4538            <Resources>
     
    4942            </Resources>
    5043            <Components>
    51                 <olac>
    52 
     44                <OLAC-DcmiTerms>
     45
     46                    <xsl:apply-templates select="//dcterms:abstract"/>
     47                    <xsl:apply-templates select="//dcterms:accessRights"/>
     48                    <xsl:apply-templates select="//dcterms:accrualMethod"/>
     49                    <xsl:apply-templates select="//dcterms:accrualPeriodicity"/>
     50                    <xsl:apply-templates select="//dcterms:accrualPolicy"/>
     51                    <xsl:apply-templates select="//dcterms:alternative"/>
     52                    <xsl:apply-templates select="//dcterms:audience"/>
     53                    <xsl:apply-templates select="//dcterms:available"/>
     54                    <xsl:apply-templates select="//dcterms:bibliographicCitation"/>
     55                    <xsl:apply-templates select="//dcterms:conformsTo"/>
     56       
    5357                    <xsl:apply-templates select="//dc:contributor"/>
    5458                    <xsl:apply-templates select="//dc:coverage"/>
     59
     60                    <xsl:apply-templates select="//dcterms:created"/>
     61
    5562                    <xsl:apply-templates select="//dc:creator"/>
    5663                    <xsl:apply-templates select="//dc:date"/>
     64                   
     65                    <xsl:apply-templates select="//dcterms:dateAccepted"/>
     66                    <xsl:apply-templates select="//dcterms:dateCopyrighted"/>
     67                    <xsl:apply-templates select="//dcterms:dateSubmitted"/>
     68
    5769                    <xsl:apply-templates select="//dc:description"/>
     70                   
     71                    <xsl:apply-templates select="//dcterms:educationLevel"/>
     72                    <xsl:apply-templates select="//dcterms:extent"/>
     73                   
    5874                    <xsl:apply-templates select="//dc:format"/>
     75                   
     76                    <xsl:apply-templates select="//dcterms:hasFormat"/>
     77                    <xsl:apply-templates select="//dcterms:hasPart"/>
     78                    <xsl:apply-templates select="//dcterms:hasVersion"/>
     79
    5980                    <xsl:apply-templates select="//dc:identifier"/>
     81
     82                    <xsl:apply-templates select="//dc:instructionalMethod"/>
     83                   
     84                    <xsl:apply-templates select="//dcterms:isFormatOf"/>
     85                    <xsl:apply-templates select="//dcterms:isPartOf"/>
     86                    <xsl:apply-templates select="//dcterms:isReferencedBy"/>                   
     87                    <xsl:apply-templates select="//dcterms:isReplacedBy"/>
     88                    <xsl:apply-templates select="//dcterms:isRequiredBy"/>
     89                    <xsl:apply-templates select="//dcterms:issued"/>
     90                    <xsl:apply-templates select="//dcterms:isVersionOf"/>
     91                 
    6092                    <xsl:apply-templates select="//dc:language"/>
     93                   
     94                    <xsl:apply-templates select="//dcterms:license"/>
     95                    <xsl:apply-templates select="//dcterms:mediator"/>
     96                    <xsl:apply-templates select="//dcterms:medium"/>
     97                    <xsl:apply-templates select="//dcterms:modified"/>
     98                    <xsl:apply-templates select="//dcterms:provenance"/>
     99                   
    61100                    <xsl:apply-templates select="//dc:publisher"/>
     101                   
     102                    <xsl:apply-templates select="//dcterms:references"/>
     103                 
    62104                    <xsl:apply-templates select="//dc:relation"/>
     105
     106                    <xsl:apply-templates select="//dcterms:replaces"/>
     107                    <xsl:apply-templates select="//dcterms:requires"/>
     108                   
    63109                    <xsl:apply-templates select="//dc:rights"/>
     110                   
     111                    <xsl:apply-templates select="//dcterms:rightsHolder"/>
     112                   
    64113                    <xsl:apply-templates select="//dc:source"/>
     114                   
     115                    <xsl:apply-templates select="//dcterms:spatial"/>
     116                   
    65117                    <xsl:apply-templates select="//dc:subject"/>
     118                   
     119                    <xsl:apply-templates select="//dcterms:tableOfContents"/>
     120                    <xsl:apply-templates select="//dcterms:temporal"/>
     121                   
    66122                    <xsl:apply-templates select="//dc:title"/>
    67123                    <xsl:apply-templates select="//dc:type"/>
    68 
    69                 </olac>
     124                   
     125                    <xsl:apply-templates select="//dcterms:valid"/>
     126
     127                </OLAC-DcmiTerms>
    70128            </Components>
    71129        </CMD>
     
    73131
    74132    <xsl:template match="dc:contributor">
    75         <olac-contributor>
     133        <contributor>
    76134            <xsl:if test="@xsi:type='olac:role'">
    77135                <xsl:attribute name="olac-role">
    78                     <xsl:value-of select="@olac:code"/>
     136                    <!-- note: namespace wildcard necessary to match with both OLAC 1.0 and 1.1 -->
     137                    <xsl:value-of select="@*:code"/>
    79138                </xsl:attribute>
    80139            </xsl:if>
    81             <xsl:value-of select="."/>
    82         </olac-contributor>
    83     </xsl:template>
    84 
    85 
    86     <xsl:template match="dc:creator">
    87         <olac-creator>
    88             <xsl:value-of select="."/>
    89         </olac-creator>
    90     </xsl:template>
    91 
    92     <xsl:template match="dc:date">
    93         <olac-date>
    94             <xsl:value-of select="."/>
    95         </olac-date>
     140            <xsl:value-of select="."/>
     141        </contributor>
    96142    </xsl:template>
    97143
    98144    <xsl:template match="dc:description">
    99         <olac-description>
    100            <xsl:apply-templates select="./@xml:lang"/>           
    101             <xsl:value-of select="."/>
    102         </olac-description>
    103     </xsl:template>
    104 
    105     <xsl:template match="dc:format">
    106         <olac-format>
    107             <xsl:value-of select="."/>
    108         </olac-format>
    109     </xsl:template>
    110 
    111     <xsl:template match="dc:identifier">
    112         <olac-identifier>
    113             <xsl:value-of select="."/>
    114         </olac-identifier>
    115     </xsl:template>
    116 
    117     <xsl:template match="dc:language">
    118         <olac-language>
    119             <xsl:value-of select="."/>
    120         </olac-language>
     145        <description>
     146            <xsl:apply-templates select="./@xml:lang"/>
     147            <xsl:value-of select="."/>
     148        </description>
    121149    </xsl:template>
    122150
    123151    <xsl:template match="dc:language[@xsi:type='olac:language']" priority="3">
    124         <olac-language>
     152        <language>
    125153            <xsl:attribute name="olac-language">
    126                 <xsl:value-of select="@olac:code"/>
    127             </xsl:attribute>
    128         </olac-language>
    129     </xsl:template>
    130 
    131 
    132     <xsl:template match="dc:publisher">
    133         <olac-publisher>
    134             <xsl:value-of select="."/>
    135         </olac-publisher>
    136     </xsl:template>
    137 
    138     <xsl:template match="dc:relation">
    139         <olac-relation>
    140             <xsl:value-of select="."/>
    141         </olac-relation>
    142     </xsl:template>
    143 
    144 
    145     <xsl:template match="dc:rights">
    146         <olac-rights>
    147             <xsl:value-of select="."/>
    148         </olac-rights>
    149     </xsl:template>
    150 
    151 
    152     <xsl:template match="//dc:subject[@xsi:type='olac:linguistic-field']" priority="3">
    153         <olac-subject>
     154                <xsl:value-of select="@*:code"/>
     155            </xsl:attribute>
     156        </language>
     157    </xsl:template>
     158
     159    <xsl:template match="dc:subject[@xsi:type='olac:language']" priority="3">
     160        <subject>
     161            <xsl:attribute name="olac-language">
     162                <xsl:value-of select="@*:code"/>
     163            </xsl:attribute>
     164        </subject>
     165    </xsl:template>
     166
     167   <xsl:template match="//dc:subject[@xsi:type='olac:linguistic-field']" priority="3">
     168        <subject>
    154169            <xsl:attribute name="olac-linguistic-field">
    155                 <xsl:value-of select="@olac:code"/>
    156             </xsl:attribute>
    157         </olac-subject>
     170                <xsl:value-of select="@*:code"/>
     171            </xsl:attribute>
     172        </subject>
    158173    </xsl:template>
    159174
    160175    <xsl:template match="//dc:subject[@xsi:type='olac:discourse-type']" priority="3">
    161         <olac-subject>
     176        <subject>
    162177            <xsl:attribute name="olac-discourse-type">
    163                 <xsl:value-of select="@olac:code"/>
    164             </xsl:attribute>
    165         </olac-subject>
     178                <xsl:value-of select="@*:code"/>
     179            </xsl:attribute>
     180        </subject>
    166181    </xsl:template>
    167182
    168183
    169184    <xsl:template match="//dc:subject" priority="1">
    170         <olac-subject>
     185        <subject>
    171186            <xsl:apply-templates select="./@xml:lang"/>
    172187            <xsl:value-of select="."/>
    173         </olac-subject>
     188        </subject>
    174189    </xsl:template>
    175190
     
    186201        <type>
    187202            <xsl:attribute name="olac-discourse-type">
    188                 <xsl:value-of select="@olac:code"/>
     203                <xsl:value-of select="@*:code"/>
    189204            </xsl:attribute>
    190205        </type>
     
    195210        <type>
    196211            <xsl:attribute name="olac-linguistic-type">
    197                 <xsl:value-of select="@olac:code"/>
     212                <xsl:value-of select="@*:code"/>
    198213            </xsl:attribute>
    199214        </type>
     
    212227        </xsl:attribute>
    213228    </xsl:template>
     229
     230
     231    <!--  general DC  template -->
     232    <xsl:template match="dc:*">
     233        <xsl:variable name="tagname">
     234            <xsl:value-of select="local-name()"/>
     235        </xsl:variable>
     236        <xsl:element name="{$tagname}">
     237            <xsl:value-of select="."/>
     238        </xsl:element>
     239    </xsl:template>
     240
     241    <!--  general DC terms template -->
     242    <xsl:template match="dcterms:*">
     243        <xsl:variable name="tagname">
     244            <xsl:value-of select="local-name()"/>
     245        </xsl:variable>
     246        <xsl:element name="{$tagname}">
     247            <xsl:value-of select="."/>
     248        </xsl:element>
     249    </xsl:template>
     250
    214251
    215252
Note: See TracChangeset for help on using the changeset viewer.