Changeset 4064 for metadata


Ignore:
Timestamp:
11/20/13 18:16:46 (11 years ago)
Author:
sanmai
Message:
  • Handles and $uri-base parameter in the IMDI input produce more appropriate texts for the MdSelfLink? and ResourceProxy? elements.
  • Add LandingPage? ResourceProxy? elements for multiple cases, so that the IMDI file can be easily viewed in TLA's IMDI Browser.
  • Allow for a prefix before the MdCollectionDisplaynNme? (parameter supplied by processor), e.g. "TLA" -> "TLA: $collection".
  • Use typing and XSLT functions to improve robustness.
  • First work on improving readability by aligning element attributes vertically.
  • In 2 error states, terminate processing.

See #323

File:
1 edited

Legend:

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

    r3378 r4064  
    44$LastChangedDate$
    55-->
    6 <xsl:stylesheet xmlns="http://www.clarin.eu/cmd/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    7     version="2.0" xpath-default-namespace="http://www.mpi.nl/IMDI/Schema/IMDI">
    8     <!-- this is a version of imdi2clarin.xsl that batch processes a whole directory structure of imdi files, call it from the command line like this:
    9         java -jar saxon8.jar -it main batch-imdi2clarin.xsl
    10         the last template in this file has to be modified to reflect the actual directory name
    11     -->
    12     <xsl:output method="xml" indent="yes"/>
    13 
    14     <!-- A collection name can be specified for each record. This
    15     information is extrinsic to the IMDI file, so it is given as an
    16     external parameter. Omit this if you are unsure. -->
    17     <xsl:param name="collection"/>
    18 
    19     <!-- If this optional parameter is defined, the behaviour of this
    20     stylesheet changes in the following ways: If no archive handle is
    21     available for MdSelfLink, the base URI is inserted there
    22     instead. All links (ResourceProxy elements) that contain relative
    23     paths are resolved into absolute URIs in the context of the base
    24     URI. Omit this if you are unsure. -->
    25     <xsl:param name="uri-base"/>
     6<xsl:stylesheet xmlns="http://www.clarin.eu/cmd/"
     7    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     8    xmlns:xs="http://www.w3.org/2001/XMLSchema"
     9    xmlns:MPI="http://www.mpi.nl/"
     10    version="2.0"
     11    xpath-default-namespace="http://www.mpi.nl/IMDI/Schema/IMDI">
     12   
     13    <!-- Check if Handle System handle references an object hosted by MPI or not. -->
     14    <xsl:function
     15        name="MPI:is_MPI_handle"
     16        as="xs:boolean">
     17        <xsl:param
     18            name="handle"
     19            as="xs:string"/>
     20        <xsl:sequence
     21            select="starts-with(normalize-space($handle), 'hdl:1839/')"/>
     22        <!--<xsl:value-of select="$return_value"/>-->
     23    </xsl:function>
     24   
     25    <!-- Produce URL to view IMDI file at IMDI_URL IMDI Browser based on MPI handle -->
     26    <xsl:function
     27        name="MPI:URL_to_view_in_IMDI_Browser_by_handle"
     28        as="xs:string">
     29        <xsl:param
     30            name="IMDI_URL"
     31            as="xs:string"/>
     32        <xsl:sequence
     33            select="concat($IMDI_browser_URL, 'ds/imdi_browser/?openhandle=', encode-for-uri($IMDI_URL))"/> 
     34        <!--<xsl:value-of select="$return_value"/>-->
     35    </xsl:function>
     36   
     37    <!-- Produce URL to view IMDI file at IMDI_URL IMDI Browser based on path (= URL) -->
     38    <xsl:function
     39        name="MPI:URL_to_view_in_IMDI_Browser_by_path"
     40        as="xs:string">
     41        <xsl:param
     42            name="IMDI_URL"
     43            as="xs:string"/>
     44        <xsl:sequence
     45            select="concat($IMDI_browser_URL, 'ds/imdi_browser/?openpath=', encode-for-uri($IMDI_URL))"/> 
     46        <!--<xsl:value-of select="$return_value"/>-->
     47    </xsl:function>
     48   
     49    <!-- This is a version of imdi2clarin.xsl that batch processes a whole directory structure of imdi files, call it from the command line like this:
     50    java -jar saxon8.jar -it main batch-imdi2clarin.xsl
     51    the last template in this file has to be modified to reflect the actual directory name. -->
     52    <xsl:output
     53        method="xml"
     54        indent="yes"/>
     55
     56    <!-- A collection name can be specified for each record. This information is extrinsic to the IMDI file, so it is given as an external parameter. Omit this if you are unsure. -->
     57    <xsl:param
     58        name="collection"
     59        select="''"
     60        as="xs:string"/>
     61
     62    <!-- If this optional parameter is defined, the behaviour of this stylesheet changes in the following ways: If no archive handle is
     63    available for MdSelfLink, the base URI is inserted there instead. All links (ResourceProxy elements) that contain relative
     64    paths are resolved into absolute URIs in the context of the base URI. Omit this if you are unsure. -->
     65    <xsl:param
     66        name="uri-base"
     67        select="''"
     68        as="xs:string"/>
     69   
     70    <!-- An URL (composed of scheme and host URL components) pointing to the IMDI browser -->
     71    <xsl:param
     72        name="IMDI_browser_URL"
     73        select="'http://corpus1.mpi.nl/'"
     74        as="xs:string"/>
     75
     76    <!-- A prefix for the MdCollectionDisplayName with a meaning similar to the old 'Data provider' facet in the Virtual Language Observatory. -->
     77    <xsl:param
     78        name="collection_display_name_prefix"
     79        select="'TLA'"
     80        as="xs:string"/>
    2681
    2782    <!-- definition of the SRU-searchable collections at TLA (for use later on) -->
    28     <xsl:variable name="SruSearchable">childes,ESF corpus,IFA corpus,MPI CGN,talkbank</xsl:variable>
    29 
    30     <xsl:template name="metatranscriptDelegate">
    31         <xsl:param name="profile"/>
     83    <xsl:variable
     84        name="SruSearchable"
     85        select="('childes','ESF corpus','IFA corpus','MPI CGN','talkbank')"
     86        as='xs:string+'/>
     87   
     88    <xsl:template
     89        name="metatranscriptDelegate">
     90        <xsl:param
     91            name="profile"
     92            as="xs:string"
     93            select="''"/>
     94        <xsl:param
     95            name="MdSelfLink"
     96            as="xs:string"
     97            select="''"/>
     98       
    3299        <Header>
    33             <MdCreator>imdi2clarin.xsl</MdCreator>
     100            <MdCreator><xsl:text>imdi2clarin.xsl</xsl:text></MdCreator>
    34101            <MdCreationDate>
    35                 <xsl:value-of select="format-date(current-date(), '[Y]-[M01]-[D01]')"/>
     102                <xsl:value-of
     103                    select="format-date(current-date(), '[Y]-[M01]-[D01]')"/>
    36104            </MdCreationDate>
    37105            <MdSelfLink>
    38                 <xsl:choose>
    39                     <!-- MPI handle prefix? Use handle + @format=cmdi suffix -->
    40                     <xsl:when test="starts-with(normalize-space(@ArchiveHandle), 'hdl:1839/')"><xsl:value-of select="@ArchiveHandle"/>@format=cmdi</xsl:when>
    41                     <!-- No handle? Then just use the URL -->
    42                     <xsl:when test="not($uri-base='') and normalize-space(@ArchiveHandle)=''"><xsl:value-of select="$uri-base"/></xsl:when>
    43                     <!-- Other handle prefix? Use handle (e.g. Lund) -->
    44                     <xsl:otherwise><xsl:value-of select="@ArchiveHandle"/></xsl:otherwise>
    45                 </xsl:choose>
     106                <xsl:value-of
     107                    select="$MdSelfLink"/>           
    46108            </MdSelfLink>
    47109            <MdProfile>
    48                 <xsl:value-of select="$profile"/>
     110                <xsl:value-of
     111                    select="$profile"/>
    49112            </MdProfile>
    50             <xsl:if test="$collection">
     113            <xsl:if
     114                test="not(normalize-space($collection)='')">
    51115                <MdCollectionDisplayName>
    52                     <xsl:value-of select="$collection"/>
     116                    <xsl:choose>
     117                        <xsl:when
     118                            test="not(normalize-space($collection_display_name_prefix)='')">
     119                            <xsl:value-of
     120                                select="$collection_display_name_prefix"/><xsl:text>: </xsl:text><xsl:value-of
     121                                                                                                     select="$collection"/>       
     122                        </xsl:when>
     123                        <xsl:otherwise>
     124                            <xsl:value-of
     125                                select="$collection"/>
     126                        </xsl:otherwise>
     127                    </xsl:choose>
    53128                </MdCollectionDisplayName>
    54129            </xsl:if>
     
    56131        <Resources>
    57132            <ResourceProxyList>
    58                 <xsl:apply-templates select="//Resources" mode="linking"/>
    59                 <xsl:apply-templates select="//Description[not(normalize-space(./@ArchiveHandle)='') or not(normalize-space(./@Link)='')]" mode="linking"/>
    60                 <xsl:apply-templates select="//Corpus" mode="linking"/>
     133                <ResourceProxy id="{generate-id()}">
     134                    <ResourceType><xsl:text>LandingPage</xsl:text></ResourceType>                       
     135                    <xsl:choose>
     136                        <!-- ArchiveHandle attribute has MPI handle prefix? If so, generate a LandingPage resource to the original IMDI -->
     137                        <xsl:when
     138                            test="MPI:is_MPI_handle(@ArchiveHandle)">
     139                            <xsl:choose>
     140                                <xsl:when
     141                                    test="ends-with($MdSelfLink,'@format=cmdi')">
     142                                    <ResourceRef><xsl:value-of
     143                                        select="concat(substring-before($MdSelfLink,'@format=cmdi'),'@view')"/></ResourceRef>
     144                                </xsl:when>
     145                                <xsl:otherwise>
     146                                    <ResourceRef><xsl:value-of
     147                                        select="concat($MdSelfLink,'@view')"/></ResourceRef>
     148<!--                                    <ResourceRef><xsl:value-of
     149                                        select="MPI:URL_to_view_in_IMDI_Browser_by_handle(@ArchiveHandle)"/></ResourceRef> -->
     150                                </xsl:otherwise>
     151                            </xsl:choose>                               
     152                        </xsl:when>
     153                        <!-- When ArchiveHandle is not an MPI handle, it is necessarily a (non-MPI) handle. Use $uri-base as LandingPage, because the IMDI Browser cannot show external resources. -->
     154                        <xsl:when test="not(MPI:is_MPI_handle(@ArchiveHandle)) and not(normalize-space($uri-base)='')">
     155                            <ResourceRef><xsl:value-of
     156                                select="MPI:URL_to_view_in_IMDI_Browser_by_path($uri-base)"/></ResourceRef>
     157                        </xsl:when>
     158                        <xsl:otherwise>
     159                            <xsl:message
     160                                terminate="yes">
     161                            <xsl:text>ERROR: @ArchiveHandle is not an MPI handle, but $uri-base is empty. </xsl:text><xsl:value-of select="name()"/>
     162                        </xsl:message></xsl:otherwise>
     163                    </xsl:choose>     
     164                </ResourceProxy>
     165               
     166                <xsl:apply-templates
     167                    select="//Resources"
     168                    mode="linking"/>
     169                <xsl:apply-templates
     170                    select="//Description[not(normalize-space(./@ArchiveHandle)='') or not(normalize-space(./@Link)='')]"
     171                    mode="linking"/>
     172                <xsl:apply-templates
     173                    select="//Corpus"
     174                    mode="linking"/>
    61175                <!-- If this collection name is indicated to be SRU-searchable, add a link to the TLA SRU endpoint -->
    62                 <xsl:if test="$collection and contains($SruSearchable,$collection)">
    63                 <ResourceProxy id="sru">
    64                     <ResourceType>SearchService</ResourceType>
    65                     <ResourceRef>http://cqlservlet.mpi.nl/</ResourceRef>
    66                 </ResourceProxy>
     176                <xsl:if
     177                    test="not(normalize-space($collection)='') and (some $searchable_collection in $SruSearchable satisfies $collection = $searchable_collection)">
     178                    <ResourceProxy id="sru">
     179                        <ResourceType><xsl:text>SearchService</xsl:text></ResourceType>
     180                        <ResourceRef><xsl:text>http://cqlservlet.mpi.nl/</xsl:text></ResourceRef>
     181                    </ResourceProxy>
    67182                </xsl:if>
    68183            </ResourceProxyList>
     
    71186        </Resources>
    72187        <Components>
    73             <xsl:apply-templates select="Session"/>
    74             <xsl:apply-templates select="Corpus"/>
     188            <xsl:apply-templates
     189                select="Session"/>
     190            <xsl:apply-templates
     191                select="Corpus"/>
    75192        </Components>
    76193    </xsl:template>
    77194
    78     <xsl:template match="METATRANSCRIPT">
     195    <xsl:template
     196        match="METATRANSCRIPT"
     197        name="METATRANSCRIPT_rec">
     198        <xsl:param
     199            name="MdSelfLink"
     200            select="''"
     201            as="xs:string"/>
    79202        <xsl:choose>
    80             <xsl:when test=".[@Type='SESSION'] or .[@Type='SESSION.Profile']">
    81                 <CMD CMDVersion="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    82                     xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1271859438204/xsd">
    83                     <xsl:call-template name="metatranscriptDelegate">
    84                         <xsl:with-param name="profile"
    85                             >clarin.eu:cr1:p_1271859438204</xsl:with-param>
    86                     </xsl:call-template>
    87                 </CMD>
    88             </xsl:when>
    89             <xsl:when test=".[@Type='CORPUS'] or .[@Type='CORPUS.Profile']">
    90                 <CMD CMDVersion="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    91                     xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1274880881885/xsd">
    92                     <xsl:call-template name="metatranscriptDelegate">
    93                         <xsl:with-param name="profile"
    94                             >clarin.eu:cr1:p_1274880881885</xsl:with-param>
    95                     </xsl:call-template>
    96                 </CMD>
     203            <xsl:when
     204                test="not(normalize-space($MdSelfLink))">
     205                <xsl:choose>
     206                    <!-- MPI handle prefix? Use handle + @format=cmdi suffix -->
     207                    <xsl:when
     208                        test="MPI:is_MPI_handle(@ArchiveHandle)">
     209                        <xsl:call-template
     210                            name="METATRANSCRIPT_rec">
     211                            <xsl:with-param
     212                                name="MdSelfLink"
     213                                as="xs:string"
     214                                select="concat(@ArchiveHandle, '@format=cmdi')"/>
     215                        </xsl:call-template>
     216                    </xsl:when>
     217                    <!-- No handle but $uri-base was specified? Then use $uri-base. -->
     218                    <xsl:when
     219                        test="not($uri-base='') and normalize-space(@ArchiveHandle)=''">
     220                        <xsl:call-template
     221                            name="METATRANSCRIPT_rec">
     222                            <xsl:with-param
     223                                name="MdSelfLink"
     224                                as="xs:string"
     225                                select="$uri-base"/>
     226                        </xsl:call-template>
     227                    </xsl:when>
     228                    <!-- Other handle prefix? Use handle (e.g. Lund) -->
     229                    <xsl:otherwise>
     230                        <xsl:call-template
     231                            name="METATRANSCRIPT_rec">
     232                            <xsl:with-param
     233                                name="MdSelfLink"
     234                                as="xs:string"
     235                                select="@ArchiveHandle"/>
     236                        </xsl:call-template>
     237                    </xsl:otherwise>
     238                </xsl:choose>
    97239            </xsl:when>
    98240            <xsl:otherwise>
    99                 <!--                Currently we are only processing 'SESSION' and 'CORPUS' types. The error displayed can be used to filter out erroneous files after processing-->
    100                 ERROR: Invalid METATRANSCRIPT Type! </xsl:otherwise>
     241               <xsl:choose>
     242                   <xsl:when
     243                       test=".[@Type='SESSION'] or .[@Type='SESSION.Profile']">
     244                       <CMD
     245                           CMDVersion="1.1"
     246                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     247                           xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1271859438204/xsd">
     248                           <xsl:call-template
     249                               name="metatranscriptDelegate">
     250                               <xsl:with-param
     251                                   name="profile"
     252                                   as="xs:string"
     253                                   select="'clarin.eu:cr1:p_1271859438204'"/>
     254                               <xsl:with-param
     255                                   name="MdSelfLink"
     256                                   as="xs:string"
     257                                   select="$MdSelfLink"/>
     258                           </xsl:call-template>
     259                       </CMD>
     260                   </xsl:when>
     261                   <xsl:when test=".[@Type='CORPUS'] or .[@Type='CORPUS.Profile']">
     262                       <CMD
     263                           CMDVersion="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     264                           xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1274880881885/xsd">
     265                           <xsl:call-template
     266                               name="metatranscriptDelegate">
     267                               <xsl:with-param
     268                                   name="profile"
     269                                   select="'clarin.eu:cr1:p_1274880881885'"/>
     270                               <xsl:with-param
     271                                   name="MdSelfLink"
     272                                   as="xs:string"
     273                                   select="$MdSelfLink"/>
     274                           </xsl:call-template>
     275                       </CMD>
     276                   </xsl:when>
     277                   <xsl:otherwise>
     278                       <!-- Currently we are only processing 'SESSION' and 'CORPUS' types. The error displayed can be used to filter out erroneous files after processing -->
     279                       <xsl:message
     280                           terminate="yes">
     281                           <xsl:text>ERROR: Invalid METATRANSCRIPT type: </xsl:text><xsl:value-of select="name()"/>
     282                       </xsl:message>
     283                    </xsl:otherwise>
     284               </xsl:choose>
     285            </xsl:otherwise>
    101286        </xsl:choose>
    102287    </xsl:template>
    103288
    104 
    105     <xsl:template match="Corpus">
     289    <xsl:template
     290        match="Corpus">
    106291        <imdi-corpus>
    107292            <Corpus>
     
    145330    </xsl:template>
    146331
    147     <xsl:template match="Corpus" mode="linking">
     332    <xsl:template
     333        match="Corpus" mode="linking">
    148334        <xsl:for-each select="CorpusLink">
    149335            <ResourceProxy id="{generate-id()}">
    150                 <!-- Do we have both archive handle and link (text content)? -->
    151                 <xsl:if test="not(normalize-space(./@ArchiveHandle)='' or normalize-space(.)='')">
    152                     <!-- Archive handle is kept, but original link is lost in CDMI. Keep content in a comment. -->
    153                     <xsl:comment>
    154                         <xsl:value-of select="."/>
    155                     </xsl:comment>
    156                 </xsl:if>
    157                 <ResourceType>Metadata</ResourceType>
     336                <ResourceType><xsl:text>Metadata</xsl:text></ResourceType>
    158337                <ResourceRef>
    159338                    <xsl:choose>
    160                         <!-- Check for archive handle attribute -->
    161339                        <xsl:when test="not(normalize-space(./@ArchiveHandle)='')">
    162                             <xsl:choose>
    163                                 <!-- MPI handle prefix? Use handle + @format=cmdi suffix -->
    164                                 <xsl:when test="starts-with(normalize-space(@ArchiveHandle), 'hdl:1839/')"><xsl:value-of select="@ArchiveHandle"/>@format=cmdi</xsl:when>
    165                                 <!-- Other handle prefix? Use handle (e.g. Lund) -->
    166                                 <xsl:otherwise><xsl:value-of select="@ArchiveHandle"/></xsl:otherwise>
    167                             </xsl:choose>
     340                            <xsl:text>test-</xsl:text><xsl:value-of select="./@ArchiveHandle"/>
    168341                        </xsl:when>
    169                         <!-- Is link a handle? -->
    170342                        <xsl:when test="starts-with(., 'hdl:')">
    171343                            <xsl:value-of select="."/>
    172344                        </xsl:when>
    173                         <!-- Fallback: use original link, append .cmdi. Resolve from base URI if available. -->
    174                         <xsl:when test="$uri-base=''"><xsl:value-of select="."/>.cmdi</xsl:when>
     345                        <xsl:when test="$uri-base=''"><xsl:value-of select="."/><xsl:text>.cmdi</xsl:text></xsl:when>
    175346                        <xsl:otherwise>
    176347                            <xsl:value-of
    177                                 select="concat(resolve-uri(normalize-space(.), $uri-base), '.cmdi')"
    178                             />
     348                                select="concat(resolve-uri(normalize-space(.), $uri-base), '.cmdi')"/>
    179349                        </xsl:otherwise>
    180350                    </xsl:choose>
     
    185355
    186356    <!-- Create ResourceProxy for MediaFile and WrittenResource -->
    187     <xsl:template match="Resources" mode="linking">
     357    <xsl:template
     358        match="Resources"
     359        mode="linking">
    188360        <xsl:for-each select="MediaFile">
    189             <xsl:call-template name="CreateResourceProxyTypeResource"/>       
     361            <xsl:call-template
     362                name="CreateResourceProxyTypeResource"/>       
    190363        </xsl:for-each>
    191         <xsl:for-each select="WrittenResource">
    192             <xsl:call-template name="CreateResourceProxyTypeResource"/>
     364        <xsl:for-each
     365            select="WrittenResource">
     366            <xsl:call-template
     367                name="CreateResourceProxyTypeResource"/>
    193368        </xsl:for-each>
    194369    </xsl:template>
    195370   
    196371    <!-- Create ResourceProxy for Info files -->
    197     <xsl:template match="//Description[@ArchiveHandle or @Link]" mode="linking">
    198         <xsl:call-template name="CreateResourceProxyTypeResource"/>
     372    <xsl:template
     373        match="//Description[@ArchiveHandle or @Link]"
     374        mode="linking">
     375        <xsl:call-template
     376            name="CreateResourceProxyTypeResource"/>
    199377    </xsl:template>
    200378   
    201     <!-- to be called during the creation of the ResourceProxyList (in linking mode) -->
    202     <xsl:template name="CreateResourceProxyTypeResource">
     379    <!-- To be called during the creation of the ResourceProxyList (in linking mode) -->
     380    <xsl:template
     381        name="CreateResourceProxyTypeResource">
    203382        <ResourceProxy id="{generate-id()}">
    204383            <ResourceType>
     
    207386                        <xsl:value-of select="./Format"/>
    208387                    </xsl:attribute>
    209                 </xsl:if>Resource</ResourceType>
     388                </xsl:if>
     389                <xsl:text>Resource</xsl:text>
     390            </ResourceType>
    210391            <ResourceRef>
    211392                <xsl:choose>
     
    228409        </ResourceProxy>
    229410    </xsl:template>
    230 
    231 
    232 
    233     <xsl:template match="Session">
     411   
     412    <xsl:template
     413        match="Session">
    234414        <Session>
    235415            <xsl:apply-templates select="child::Name"/>
     
    265445    </xsl:template>
    266446
    267     <xsl:template match="child::Name">
     447    <xsl:template
     448        match="child::Name">
    268449        <Name>
    269450            <xsl:value-of select="."/>
     
    271452    </xsl:template>
    272453
    273     <xsl:template match="child::Title">
     454    <xsl:template
     455        match="child::Title">
    274456        <Title>
    275457            <xsl:value-of select="."/>
     
    277459    </xsl:template>
    278460
    279     <xsl:template match="child::Date">
     461    <xsl:template
     462        match="child::Date">
    280463        <Date>
    281464            <xsl:value-of select="."/>
     
    283466    </xsl:template>
    284467
    285     <xsl:template match="child::MDGroup">
     468    <xsl:template
     469        match="child::MDGroup">
    286470        <MDGroup>
    287             <xsl:apply-templates select="child::Location"/>
    288             <xsl:apply-templates select="child::Project"/>
    289             <xsl:apply-templates select="child::Keys"/>
    290             <xsl:apply-templates select="child::Content"/>
    291             <xsl:apply-templates select="child::Actors"/>
     471            <xsl:apply-templates
     472                select="child::Location"/>
     473            <xsl:apply-templates
     474                select="child::Project"/>
     475            <xsl:apply-templates
     476                select="child::Keys"/>
     477            <xsl:apply-templates
     478                select="child::Content"/>
     479            <xsl:apply-templates
     480                select="child::Actors"/>
    292481        </MDGroup>
    293482    </xsl:template>
    294483
    295     <xsl:template match="Location">
     484    <xsl:template
     485        match="Location">
    296486        <Location>
    297487            <Continent>
    298                 <xsl:value-of select="child::Continent"/>
     488                <xsl:value-of
     489                    select="child::Continent"/>
    299490            </Continent>
    300491            <Country>
    301                 <xsl:value-of select="child::Country"/>
     492                <xsl:value-of
     493                    select="child::Country"/>
    302494            </Country>
    303             <xsl:if test="exists(child::Region)">
     495            <xsl:if
     496                test="exists(child::Region)">
    304497                <Region>
    305                     <xsl:value-of select="child::Region"/>
     498                    <xsl:value-of
     499                        select="child::Region"/>
    306500                </Region>
    307501            </xsl:if>
    308             <xsl:if test="exists(child::Address)">
     502            <xsl:if
     503                test="exists(child::Address)">
    309504                <Address>
    310                     <xsl:value-of select="child::Address"/>
     505                    <xsl:value-of
     506                        select="child::Address"/>
    311507                </Address>
    312508            </xsl:if>
     
    314510    </xsl:template>
    315511
    316     <xsl:template match="Project">
     512    <xsl:template
     513        match="Project">
    317514        <Project>
    318515            <Name>
     
    330527                    <xsl:for-each select="Description">
    331528                        <Description>
    332                             <xsl:attribute name="LanguageId" select="@LanguageId"/>
     529                            <xsl:attribute
     530                                name="LanguageId"
     531                                select="@LanguageId"/>
    333532                            <xsl:value-of select="."/>
    334533                        </Description>
     
    339538    </xsl:template>
    340539
    341     <xsl:template match="Contact">
     540    <xsl:template
     541        match="Contact">
    342542        <Contact>
    343543            <Name>
     
    356556    </xsl:template>
    357557
    358     <xsl:template match="Keys">
     558    <xsl:template
     559        match="Keys">
    359560        <Keys>
    360561            <xsl:for-each select="Key">
     
    369570    </xsl:template>
    370571
    371     <xsl:template match="Content">
     572    <xsl:template
     573        match="Content">
    372574        <Content>
    373575            <Genre>
     
    411613    </xsl:template>
    412614
    413     <xsl:template match="CommunicationContext">
     615    <xsl:template
     616        match="CommunicationContext">
    414617        <CommunicationContext>
    415618            <xsl:if test="exists(child::Interactivity)">
     
    446649    </xsl:template>
    447650
    448     <xsl:template match="Languages" mode="content">
     651    <xsl:template
     652        match="Languages"
     653        mode="content">
    449654        <Content_Languages>
    450655            <xsl:if test="exists(child::Description)">
    451656                <descriptions>
    452                     <xsl:for-each select="Description">
    453                         <Description>
    454                             <xsl:attribute name="LanguageId" select="@LanguageId"/>
    455                             <xsl:value-of select="."/>
    456                         </Description>
    457                     </xsl:for-each>
    458                 </descriptions>
    459             </xsl:if>
    460             <xsl:for-each select="Language">
     657                    <xsl:for-each
     658                        select="Description">
     659                        <Description>
     660                            <xsl:attribute
     661                                name="LanguageId"
     662                                select="@LanguageId"/>
     663                            <xsl:value-of
     664                                select="."/>
     665                        </Description>
     666                    </xsl:for-each>
     667                </descriptions>
     668            </xsl:if>
     669            <xsl:for-each
     670                select="Language">
    461671                <Content_Language>
    462672                    <Id>
    463                         <xsl:value-of select=" ./Id"/>
     673                        <xsl:value-of
     674                            select=" ./Id"/>
    464675                    </Id>
    465676                    <Name>
    466                         <xsl:value-of select=" ./Name"/>
     677                        <xsl:value-of
     678                            select=" ./Name"/>
    467679                    </Name>
    468                     <xsl:if test="exists(child::Dominant)">
     680                    <xsl:if
     681                        test="exists(child::Dominant)">
    469682                        <Dominant>
    470                             <xsl:value-of select=" ./Dominant"/>
     683                            <xsl:value-of
     684                                select=" ./Dominant"/>
    471685                        </Dominant>
    472686                    </xsl:if>
    473                     <xsl:if test="exists(child::SourceLanguage)">
     687                    <xsl:if
     688                        test="exists(child::SourceLanguage)">
    474689                        <SourceLanguage>
    475                             <xsl:value-of select=" ./SourceLanguage"/>
     690                            <xsl:value-of
     691                                select=" ./SourceLanguage"/>
    476692                        </SourceLanguage>
    477693                    </xsl:if>
    478                     <xsl:if test="exists(child::TargetLanguage)">
     694                    <xsl:if
     695                        test="exists(child::TargetLanguage)">
    479696                        <TargetLanguage>
    480                             <xsl:value-of select=" ./TargetLanguage"/>
     697                            <xsl:value-of
     698                                select=" ./TargetLanguage"/>
    481699                        </TargetLanguage>
    482700                    </xsl:if>
    483                     <xsl:if test="exists(child::Description)">
     701                    <xsl:if
     702                        test="exists(child::Description)">
    484703                        <descriptions>
    485                             <xsl:for-each select="Description">
     704                            <xsl:for-each
     705                                select="Description">
    486706                                <Description>
    487                                     <xsl:attribute name="LanguageId" select="@LanguageId"/>
     707                                    <xsl:attribute
     708                                        name="LanguageId"
     709                                        select="@LanguageId"/>
    488710                                    <xsl:value-of select="."/>
    489711                                </Description>
     
    496718    </xsl:template>
    497719
    498     <xsl:template match="Actors">
     720    <xsl:template
     721        match="Actors">
    499722        <Actors>
    500723            <xsl:if test="exists(child::Description)">
     
    561784    </xsl:template>
    562785
    563     <xsl:template match="Languages" mode="actor">
     786    <xsl:template
     787        match="Languages"
     788        mode="actor">
    564789        <Actor_Languages>
    565790            <xsl:if test="exists(child::Description)">
     
    606831    </xsl:template>
    607832
    608 
    609     <xsl:template match="child::Resources" mode="regular">
     833    <xsl:template
     834        match="child::Resources"
     835        mode="regular">
    610836        <Resources>
    611837            <xsl:apply-templates select="MediaFile"/>
     
    616842    </xsl:template>
    617843
    618     <xsl:template match="MediaFile">
    619         <MediaFile ref="{generate-id()}">
     844    <xsl:template
     845        match="MediaFile">
     846        <MediaFile
     847            ref="{generate-id()}">
    620848            <ResourceLink>
    621                 <xsl:value-of select=" ./ResourceLink"/>
     849                <xsl:value-of
     850                    select=" ./ResourceLink"/>
    622851            </ResourceLink>
    623852            <Type>
    624                 <xsl:value-of select=" ./Type"/>
     853                <xsl:value-of
     854                    select=" ./Type"/>
    625855            </Type>
    626856            <Format>
    627                 <xsl:value-of select=" ./Format"/>
     857                <xsl:value-of
     858                    select=" ./Format"/>
    628859            </Format>
    629860            <Size>
    630                 <xsl:value-of select=" ./Size"/>
     861                <xsl:value-of
     862                    select=" ./Size"/>
    631863            </Size>
    632864            <Quality>
    633                 <xsl:value-of select=" ./Quality"/>
     865                <xsl:value-of
     866                    select=" ./Quality"/>
    634867            </Quality>
    635868            <RecordingConditions>
    636                 <xsl:value-of select=" ./RecordingConditions"/>
     869                <xsl:value-of
     870                    select=" ./RecordingConditions"/>
    637871            </RecordingConditions>
    638872            <TimePosition>
    639873                <Start>
    640                     <xsl:apply-templates select="TimePosition/Start"/>
     874                    <xsl:apply-templates
     875                        select="TimePosition/Start"/>
    641876                </Start>
    642877                <xsl:if test="exists(descendant::End)">
    643878                    <End>
    644                         <xsl:apply-templates select="TimePosition/End"/>
     879                        <xsl:apply-templates
     880                            select="TimePosition/End"/>
    645881                    </End>
    646882                </xsl:if>
     
    651887                    <xsl:for-each select="Description">
    652888                        <Description>
    653                             <xsl:attribute name="LanguageId" select="@LanguageId"/>
     889                            <xsl:attribute
     890                                name="LanguageId"
     891                                select="@LanguageId"/>
    654892                            <xsl:value-of select="."/>
    655893                        </Description>
     
    661899    </xsl:template>
    662900
    663     <xsl:template match="Access">
     901    <xsl:template
     902        match="Access">
    664903        <Access>
    665904            <Availability>
     
    689928    </xsl:template>
    690929
    691     <xsl:template match="WrittenResource">
     930    <xsl:template
     931        match="WrittenResource">
    692932        <WrittenResource ref="{generate-id()}">
    693933            <ResourceLink>
     
    733973                    <xsl:for-each select="Description">
    734974                        <Description>
    735                             <xsl:attribute name="LanguageId" select="@LanguageId"/>
     975                            <xsl:attribute
     976                                name="LanguageId"
     977                                select="@LanguageId"/>
    736978                            <xsl:value-of select="."/>
    737979                        </Description>
     
    743985    </xsl:template>
    744986
    745     <xsl:template match="Validation">
     987    <xsl:template
     988        match="Validation">
    746989        <Validation>
    747990            <Type>
     
    7671010    </xsl:template>
    7681011
    769     <xsl:template match="Source">
     1012    <xsl:template
     1013        match="Source">
    7701014        <Source>
    7711015            <Id>
     
    8171061    </xsl:template>
    8181062
    819     <xsl:template match="Anonyms">
     1063    <xsl:template
     1064        match="Anonyms">
    8201065        <Anonyms>
    8211066            <ResourceLink>
     
    8261071    </xsl:template>
    8271072
    828     <xsl:template match="child::References">
     1073    <xsl:template
     1074        match="child::References">
    8291075        <References>
    8301076            <xsl:if test="exists(child::Description)">
     
    8411087    </xsl:template>
    8421088
    843     <xsl:template name="main">
     1089    <xsl:template
     1090        name="main">
    8441091        <xsl:for-each
    8451092            select="collection('file:///home/paucas/corpus_copy/corpus_copy/data/corpora?select=*.imdi;recurse=yes;on-error=ignore')">
Note: See TracChangeset for help on using the changeset viewer.