Changeset 986


Ignore:
Timestamp:
12/13/10 17:18:23 (13 years ago)
Author:
dietuyt
Message:

Several small fixes, among others not creating an olac attribute when
the source attribute in the OLAC record element is missing.

File:
1 edited

Legend:

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

    r984 r986  
    137137        <contributor>
    138138            <xsl:if test="@xsi:type='olac:role'">
    139                 <xsl:attribute name="olac-role">
    140                     <!-- note: namespace wildcard necessary to match with both OLAC 1.0 and 1.1 -->
    141                     <xsl:value-of select="@*:code"/>
    142                 </xsl:attribute>
     139                <xsl:if test="@*:code">
     140                    <xsl:attribute name="olac-role">
     141                        <!-- note: namespace wildcard necessary to match with both OLAC 1.0 and 1.1 -->
     142                        <xsl:value-of select="@*:code"/>
     143                    </xsl:attribute>
     144                </xsl:if>
    143145            </xsl:if>
    144146            <xsl:value-of select="."/>
     
    156158    <xsl:template match="dc:language[@xsi:type='olac:language']" priority="3">
    157159        <language>
    158             <xsl:attribute name="olac-language">
    159                 <!-- can be enabled when there is a 1-to-1 mapping in sil_to_iso6393.xml           -->
    160                 <xsl:choose>
    161                     <xsl:when test="contains(@*:code, 'x-sil-')">
    162                         <xsl:apply-templates select="$lang-top">
    163                             <xsl:with-param name="curr-label" select="."/>
    164                         </xsl:apply-templates>
    165                     </xsl:when>
    166                     <xsl:otherwise>
    167                         <xsl:value-of select="@*:code"/>
    168                     </xsl:otherwise>
    169                 </xsl:choose>
    170             </xsl:attribute>
     160            <xsl:if test="@*:code">
     161                <xsl:attribute name="olac-language">
     162                    <!-- can be enabled when there is a 1-to-1 mapping in sil_to_iso6393.xml           -->
     163                    <xsl:choose>
     164                        <xsl:when test="contains(@*:code, 'x-sil-')">
     165                            <xsl:apply-templates select="$lang-top">
     166                                <xsl:with-param name="curr-label" select="."/>
     167                            </xsl:apply-templates>
     168                        </xsl:when>
     169                        <xsl:otherwise>
     170                            <xsl:value-of select="@*:code"/>
     171                        </xsl:otherwise>
     172                    </xsl:choose>
     173                </xsl:attribute>
     174            </xsl:if>
     175            <xsl:value-of select="."/>
    171176        </language>
    172177    </xsl:template>
     
    186191        <subject>
    187192            <!-- can be enabled when there is a 1-to-1 mapping in sil_to_iso6393.xml           -->
    188             <xsl:attribute name="olac-language">
    189                 <xsl:choose>
    190                     <xsl:when test="contains(@*:code, 'x-sil-')">
    191                         <xsl:apply-templates select="$lang-top">
    192                             <xsl:with-param name="curr-label" select="."/>
    193                         </xsl:apply-templates>
    194                     </xsl:when>
    195                     <xsl:otherwise>
    196                         <xsl:value-of select="@*:code"/>
    197                     </xsl:otherwise>
    198                 </xsl:choose>
    199             </xsl:attribute>
     193            <xsl:if test="@*:code">
     194                <xsl:attribute name="olac-language">
     195                    <xsl:choose>
     196                        <xsl:when test="contains(@*:code, 'x-sil-')">
     197                            <xsl:apply-templates select="$lang-top">
     198                                <xsl:with-param name="curr-label" select="."/>
     199                            </xsl:apply-templates>
     200                        </xsl:when>
     201                        <xsl:otherwise>
     202                            <xsl:value-of select="@*:code"/>
     203                        </xsl:otherwise>
     204                    </xsl:choose>
     205                </xsl:attribute>
     206            </xsl:if>
     207            <xsl:value-of select="."/>
    200208        </subject>
    201209    </xsl:template>
     
    203211    <xsl:template match="//dc:subject[@xsi:type='olac:linguistic-field']" priority="3">
    204212        <subject>
    205             <xsl:attribute name="olac-linguistic-field">
    206                 <xsl:value-of select="@*:code"/>
    207             </xsl:attribute>
     213            <xsl:if test="@*:code">
     214                <xsl:attribute name="olac-linguistic-field">
     215                    <xsl:value-of select="@*:code"/>
     216                </xsl:attribute>
     217            </xsl:if>
     218            <xsl:value-of select="."/>
    208219        </subject>
    209220    </xsl:template>
     
    214225                <xsl:value-of select="@*:code"/>
    215226            </xsl:attribute>
     227            <xsl:value-of select="."/>
    216228        </subject>
    217229    </xsl:template>
     
    238250    <xsl:template match="//dc:type[@xsi:type='olac:discourse-type']" priority="2">
    239251        <type>
    240             <xsl:attribute name="olac-discourse-type">
    241                 <xsl:value-of select="@*:code"/>
    242             </xsl:attribute>
     252            <xsl:if test="@*:code">
     253                <xsl:attribute name="olac-discourse-type">
     254                    <xsl:value-of select="@*:code"/>
     255                </xsl:attribute>
     256            </xsl:if>
     257            <xsl:value-of select="."/>
    243258        </type>
    244259    </xsl:template>
     
    247262    <xsl:template match="//dc:type[@xsi:type='olac:linguistic-type']" priority="2">
    248263        <type>
    249             <xsl:attribute name="olac-linguistic-type">
    250                 <xsl:value-of select="@*:code"/>
    251             </xsl:attribute>
     264            <xsl:if test="@*:code">
     265                <xsl:attribute name="olac-linguistic-type">
     266                    <xsl:value-of select="@*:code"/>
     267                </xsl:attribute>
     268            </xsl:if>
     269            <xsl:value-of select="."/>
    252270        </type>
    253271    </xsl:template>
Note: See TracChangeset for help on using the changeset viewer.