Changeset 997


Ignore:
Timestamp:
12/15/10 13:19:19 (13 years ago)
Author:
paucas
Message:
  • added reference to xsd
  • added mimetype attribute
  • added handle reference
File:
1 edited

Legend:

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

    r476 r997  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xpath-default-namespace="http://www.mpi.nl/IMDI/Schema/IMDI">
    3 <!-- 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:
     2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
     3    xpath-default-namespace="http://www.mpi.nl/IMDI/Schema/IMDI">
     4    <!-- 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:
    45        java -jar saxon8.jar -it main batch-imdi2clarin.xsl
    56        the last template in this file has to be modified to reflect the actual directory name
    67-->
    7     <xsl:output method="xml" indent="yes" />
    8    
     8    <xsl:output method="xml" indent="yes"/>
     9
     10    <xsl:template name="metatranscriptDelegate">
     11        <Header>
     12            <MdSelfLink>test-<xsl:value-of select="@ArchiveHandle"/></MdSelfLink>
     13        </Header>
     14        <Resources>
     15            <ResourceProxyList>
     16                <xsl:apply-templates select="//Resources" mode="linking"/>
     17                <xsl:apply-templates select="//Corpus" mode="linking"/>
     18            </ResourceProxyList>
     19            <JournalFileProxyList> </JournalFileProxyList>
     20            <ResourceRelationList> </ResourceRelationList>
     21        </Resources>
     22        <Components>
     23            <xsl:apply-templates select="Session"/>
     24            <xsl:apply-templates select="Corpus"/>
     25        </Components>
     26    </xsl:template>
     27
    928    <xsl:template match="METATRANSCRIPT">
    10         <CMD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    11             <Header>
    12                 <MdSelfLink>test-<xsl:value-of select="@ArchiveHandle" /></MdSelfLink>               
    13             </Header>
    14             <Resources>
    15                 <ResourceProxyList>
    16                     <xsl:apply-templates select="//Resources" mode="linking"/>
    17                     <xsl:apply-templates select="//Corpus" mode="linking"/>
    18                 </ResourceProxyList>
    19                 <JournalFileProxyList>
    20                 </JournalFileProxyList>
    21                 <ResourceRelationList>
    22                 </ResourceRelationList>
    23             </Resources>
    24             <Components>       
    25                 <xsl:apply-templates select="Session" />
    26                 <xsl:apply-templates select="Corpus" />
    27             </Components>
    28         </CMD>
    29        
    30     </xsl:template>
    31    
    32    
     29        <xsl:choose>
     30            <xsl:when test=".[@Type='SESSION']">
     31                <CMD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     32                    xsi:schemaLocation="http://www.clarin.eu/cmd http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1271859438204/xsd">
     33                    <xsl:call-template name="metatranscriptDelegate"/>
     34                </CMD>
     35            </xsl:when>
     36            <xsl:when test=".[@Type='CORPUS']">
     37                <CMD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     38                    xsi:schemaLocation="http://www.clarin.eu/cmd http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1274880881885/xsd">
     39                    <xsl:call-template name="metatranscriptDelegate"/>
     40                </CMD>
     41            </xsl:when>
     42            <xsl:otherwise>
     43                <!--                Currently we are only processing 'SESSION' and 'CORPUS' types.-->
     44            </xsl:otherwise>
     45        </xsl:choose>
     46    </xsl:template>
     47
     48
    3349    <xsl:template match="Corpus">
    3450        <imdi-corpus>
     
    4460                        </CorpusLink>
    4561                    </xsl:for-each>
    46                 </xsl:if>   
     62                </xsl:if>
    4763                <xsl:if test="exists(child::Description)">
    4864                    <descriptions>
     
    5369                            </Description>
    5470                        </xsl:for-each>
    55                     </descriptions>               
    56                 </xsl:if>                   
     71                    </descriptions>
     72                </xsl:if>
    5773            </Corpus>
    5874        </imdi-corpus>
    5975    </xsl:template>
    60    
     76
    6177    <xsl:template match="Corpus" mode="linking">
    6278        <xsl:for-each select="CorpusLink">
    63             <ResourceProxy id="{generate-id()}">               
     79            <ResourceProxy id="{generate-id()}">
    6480                <ResourceType>Metadata</ResourceType>
    6581                <ResourceRef><xsl:value-of select="."/>.cmdi</ResourceRef>
     
    6783        </xsl:for-each>
    6884    </xsl:template>
    69    
     85
    7086    <xsl:template match="Resources" mode="linking">
    7187        <xsl:for-each select="MediaFile">
    72             <ResourceProxy id="{generate-id()}">               
    73                 <ResourceType>Resource</ResourceType>
    74                 <ResourceRef><xsl:value-of select="replace(ResourceLink,'file:/data/corpora','http://corpus1.mpi.nl')"/></ResourceRef>
     88            <ResourceProxy id="{generate-id()}">
     89                <ResourceType>
     90                    <xsl:if test="exists(Format) and not(empty(Format))">
     91                        <xsl:attribute name="mimetype">
     92                            <xsl:value-of select="./Format"/>
     93                        </xsl:attribute>
     94                    </xsl:if>Resource</ResourceType>
     95                <ResourceRef>
     96                    <xsl:value-of select="ResourceLink/@ArchiveHandle"/>
     97                </ResourceRef>
    7598            </ResourceProxy>
    7699        </xsl:for-each>
    77100        <xsl:for-each select="WrittenResource">
    78             <ResourceProxy id="{generate-id()}">               
    79                 <ResourceType>Resource</ResourceType>
    80                 <ResourceRef><xsl:value-of select="replace(ResourceLink,'file:/data/corpora','http://corpus1.mpi.nl')"/></ResourceRef>
     101            <ResourceProxy id="{generate-id()}">
     102                <ResourceType>
     103                    <xsl:if test="exists(Format) and not(empty(Format))">
     104                        <xsl:attribute name="mimetype">
     105                            <xsl:value-of select="./Format"/>
     106                        </xsl:attribute>
     107                    </xsl:if>Resource</ResourceType>
     108                <ResourceRef>
     109                    <xsl:value-of select="ResourceLink/@ArchiveHandle"/>
     110                </ResourceRef>
    81111            </ResourceProxy>
    82112        </xsl:for-each>
    83113    </xsl:template>
    84    
     114
    85115    <xsl:template match="Session">
    86116        <Session>
     
    96126                        </Description>
    97127                    </xsl:for-each>
    98                 </descriptions>               
    99             </xsl:if>           
     128                </descriptions>
     129            </xsl:if>
    100130            <xsl:apply-templates select="child::MDGroup"/>
    101131            <xsl:apply-templates select="child::Resources" mode="regular"/>
     
    103133        </Session>
    104134    </xsl:template>
    105    
     135
    106136    <xsl:template match="child::Name">
    107137        <Name>
     
    109139        </Name>
    110140    </xsl:template>
    111    
     141
    112142    <xsl:template match="child::Title">
    113143        <Title>
     
    115145        </Title>
    116146    </xsl:template>
    117    
     147
    118148    <xsl:template match="child::Date">
    119149        <Date>
     
    121151        </Date>
    122152    </xsl:template>
    123    
     153
    124154    <xsl:template match="child::MDGroup">
    125155        <MDGroup>
     
    128158            <xsl:apply-templates select="child::Keys"/>
    129159            <xsl:apply-templates select="child::Content"/>
    130             <xsl:apply-templates select="child::Actors"/>           
     160            <xsl:apply-templates select="child::Actors"/>
    131161        </MDGroup>
    132162    </xsl:template>
    133    
     163
    134164    <xsl:template match="Location">
    135165        <Location>
    136             <Continent><xsl:value-of select="child::Continent"/></Continent>
    137             <Country><xsl:value-of select="child::Country"/></Country>
     166            <Continent>
     167                <xsl:value-of select="child::Continent"/>
     168            </Continent>
     169            <Country>
     170                <xsl:value-of select="child::Country"/>
     171            </Country>
    138172            <xsl:if test="exists(child::Region)">
    139                 <Region><xsl:value-of select="child::Region"/></Region>
     173                <Region>
     174                    <xsl:value-of select="child::Region"/>
     175                </Region>
    140176            </xsl:if>
    141177            <xsl:if test="exists(child::Address)">
    142                 <Address><xsl:value-of select="child::Address"/></Address>
    143             </xsl:if>
    144         </Location>       
    145     </xsl:template>
    146    
     178                <Address>
     179                    <xsl:value-of select="child::Address"/>
     180                </Address>
     181            </xsl:if>
     182        </Location>
     183    </xsl:template>
     184
    147185    <xsl:template match="Project">
    148186        <Project>
    149             <Name><xsl:value-of select="child::Name"/></Name>
    150             <Title><xsl:value-of select="child::Title"/></Title>
    151             <Id><xsl:value-of select="child::Id"/></Id>
     187            <Name>
     188                <xsl:value-of select="child::Name"/>
     189            </Name>
     190            <Title>
     191                <xsl:value-of select="child::Title"/>
     192            </Title>
     193            <Id>
     194                <xsl:value-of select="child::Id"/>
     195            </Id>
    152196            <xsl:apply-templates select="Contact"/>
    153197            <xsl:if test="exists(child::Description)">
     
    159203                        </Description>
    160204                    </xsl:for-each>
    161                 </descriptions>               
     205                </descriptions>
    162206            </xsl:if>
    163207        </Project>
    164208    </xsl:template>
    165    
     209
    166210    <xsl:template match="Contact">
    167211        <Contact>
    168             <Name><xsl:value-of select="child::Name"/></Name>
    169             <Address><xsl:value-of select="child::Address"/></Address>
    170             <Email><xsl:value-of select="child::Email"/></Email>
    171             <Organisation><xsl:value-of select="child::Organisation"/></Organisation>
    172         </Contact>       
    173     </xsl:template>
    174    
     212            <Name>
     213                <xsl:value-of select="child::Name"/>
     214            </Name>
     215            <Address>
     216                <xsl:value-of select="child::Address"/>
     217            </Address>
     218            <Email>
     219                <xsl:value-of select="child::Email"/>
     220            </Email>
     221            <Organisation>
     222                <xsl:value-of select="child::Organisation"/>
     223            </Organisation>
     224        </Contact>
     225    </xsl:template>
     226
    175227    <xsl:template match="Keys">
    176228        <Keys>
    177229            <xsl:for-each select="Key">
    178                 <Key><xsl:attribute name="Name"><xsl:value-of select="@Name"></xsl:value-of></xsl:attribute><xsl:value-of select="."></xsl:value-of></Key>
     230                <Key>
     231                    <xsl:attribute name="Name">
     232                        <xsl:value-of select="@Name"/>
     233                    </xsl:attribute>
     234                    <xsl:value-of select="."/>
     235                </Key>
    179236            </xsl:for-each>
    180237        </Keys>
    181238    </xsl:template>
    182    
     239
    183240    <xsl:template match="Content">
    184241        <Content>
    185             <Genre><xsl:value-of select="child::Genre"/></Genre>
     242            <Genre>
     243                <xsl:value-of select="child::Genre"/>
     244            </Genre>
    186245            <xsl:if test="exists(child::SubGenre)">
    187                 <SubGenre><xsl:value-of select="child::SubGenre"/></SubGenre>
     246                <SubGenre>
     247                    <xsl:value-of select="child::SubGenre"/>
     248                </SubGenre>
    188249            </xsl:if>
    189250            <xsl:if test="exists(child::Task)">
    190                 <Task><xsl:value-of select="child::Task"/></Task>
     251                <Task>
     252                    <xsl:value-of select="child::Task"/>
     253                </Task>
    191254            </xsl:if>
    192255            <xsl:if test="exists(child::Modalities)">
    193                 <Modalities><xsl:value-of select="child::Modalities"/></Modalities>
     256                <Modalities>
     257                    <xsl:value-of select="child::Modalities"/>
     258                </Modalities>
    194259            </xsl:if>
    195260            <xsl:if test="exists(child::Subject)">
    196                 <Subject><xsl:value-of select="child::Subject"/></Subject>
     261                <Subject>
     262                    <xsl:value-of select="child::Subject"/>
     263                </Subject>
    197264            </xsl:if>
    198265            <xsl:apply-templates select="child::CommunicationContext"/>
     
    207274                        </Description>
    208275                    </xsl:for-each>
    209                 </descriptions>               
     276                </descriptions>
    210277            </xsl:if>
    211278        </Content>
    212        
    213     </xsl:template>
    214    
     279
     280    </xsl:template>
     281
    215282    <xsl:template match="CommunicationContext">
    216283        <CommunicationContext>
    217284            <xsl:if test="exists(child::Interactivity)">
    218                 <Interactivity><xsl:value-of select="child::Interactivity"/></Interactivity>
     285                <Interactivity>
     286                    <xsl:value-of select="child::Interactivity"/>
     287                </Interactivity>
    219288            </xsl:if>
    220289            <xsl:if test="exists(child::PlanningType)">
    221                 <PlanningType><xsl:value-of select="child::PlanningType"/></PlanningType>
     290                <PlanningType>
     291                    <xsl:value-of select="child::PlanningType"/>
     292                </PlanningType>
    222293            </xsl:if>
    223294            <xsl:if test="exists(child::Involvement)">
    224                 <Involvement><xsl:value-of select="child::Involvement"/></Involvement>
     295                <Involvement>
     296                    <xsl:value-of select="child::Involvement"/>
     297                </Involvement>
    225298            </xsl:if>
    226299            <xsl:if test="exists(child::SocialContext)">
    227                 <SocialContext><xsl:value-of select="child::SocialContext"/></SocialContext>
     300                <SocialContext>
     301                    <xsl:value-of select="child::SocialContext"/>
     302                </SocialContext>
    228303            </xsl:if>
    229304            <xsl:if test="exists(child::EventStructure)">
    230                 <EventStructure><xsl:value-of select="child::EventStructure"/></EventStructure>
     305                <EventStructure>
     306                    <xsl:value-of select="child::EventStructure"/>
     307                </EventStructure>
    231308            </xsl:if>
    232309            <xsl:if test="exists(child::Channel)">
    233                 <Channel><xsl:value-of select="child::Channel"/></Channel>
     310                <Channel>
     311                    <xsl:value-of select="child::Channel"/>
     312                </Channel>
    234313            </xsl:if>
    235314        </CommunicationContext>
    236315    </xsl:template>
    237    
     316
    238317    <xsl:template match="Languages" mode="content">
    239318        <Content_Languages>
     
    246325                        </Description>
    247326                    </xsl:for-each>
    248                 </descriptions>               
     327                </descriptions>
    249328            </xsl:if>
    250329            <xsl:for-each select="Language">
    251330                <Content_Language>
    252                     <Id><xsl:value-of select=" ./Id"/></Id>
    253                     <Name><xsl:value-of select=" ./Name"/></Name>
     331                    <Id>
     332                        <xsl:value-of select=" ./Id"/>
     333                    </Id>
     334                    <Name>
     335                        <xsl:value-of select=" ./Name"/>
     336                    </Name>
    254337                    <xsl:if test="exists(child::Dominant)">
    255                         <Dominant><xsl:value-of select=" ./Dominant"/></Dominant>
     338                        <Dominant>
     339                            <xsl:value-of select=" ./Dominant"/>
     340                        </Dominant>
    256341                    </xsl:if>
    257342                    <xsl:if test="exists(child::SourceLanguage)">
    258                         <SourceLanguage><xsl:value-of select=" ./SourceLanguage"/></SourceLanguage>
     343                        <SourceLanguage>
     344                            <xsl:value-of select=" ./SourceLanguage"/>
     345                        </SourceLanguage>
    259346                    </xsl:if>
    260347                    <xsl:if test="exists(child::TargetLanguage)">
    261                         <TargetLanguage><xsl:value-of select=" ./TargetLanguage"/></TargetLanguage>
     348                        <TargetLanguage>
     349                            <xsl:value-of select=" ./TargetLanguage"/>
     350                        </TargetLanguage>
    262351                    </xsl:if>
    263352                    <xsl:if test="exists(child::Description)">
     
    269358                                </Description>
    270359                            </xsl:for-each>
    271                         </descriptions>               
     360                        </descriptions>
    272361                    </xsl:if>
    273362                </Content_Language>
     
    286375                        </Description>
    287376                    </xsl:for-each>
    288                 </descriptions>               
     377                </descriptions>
    289378            </xsl:if>
    290379            <xsl:for-each select="Actor">
    291380                <Actor>
    292                     <Role><xsl:value-of select=" ./Role"/></Role>
    293                     <Name><xsl:value-of select=" ./Name"/></Name>
    294                     <FullName><xsl:value-of select=" ./FullName"/></FullName>
    295                     <Code><xsl:value-of select=" ./Code"/></Code>
    296                     <FamilySocialRole><xsl:value-of select=" ./FamilySocialRole"/></FamilySocialRole>
    297                     <EthnicGroup><xsl:value-of select=" ./EthnicGroup"/></EthnicGroup>
    298                     <Age><xsl:value-of select=" ./Age"/></Age>
    299                     <BirthDate><xsl:value-of select=" ./BirthDate"/></BirthDate>
    300                     <Sex><xsl:value-of select=" ./Sex"/></Sex>
    301                     <Education><xsl:value-of select=" ./Education"/></Education>
    302                     <Anonymized><xsl:value-of select=" ./Anonymized"/></Anonymized>
    303                     <xsl:apply-templates select="Contact" />
     381                    <Role>
     382                        <xsl:value-of select=" ./Role"/>
     383                    </Role>
     384                    <Name>
     385                        <xsl:value-of select=" ./Name"/>
     386                    </Name>
     387                    <FullName>
     388                        <xsl:value-of select=" ./FullName"/>
     389                    </FullName>
     390                    <Code>
     391                        <xsl:value-of select=" ./Code"/>
     392                    </Code>
     393                    <FamilySocialRole>
     394                        <xsl:value-of select=" ./FamilySocialRole"/>
     395                    </FamilySocialRole>
     396                    <EthnicGroup>
     397                        <xsl:value-of select=" ./EthnicGroup"/>
     398                    </EthnicGroup>
     399                    <Age>
     400                        <xsl:value-of select=" ./Age"/>
     401                    </Age>
     402                    <BirthDate>
     403                        <xsl:value-of select=" ./BirthDate"/>
     404                    </BirthDate>
     405                    <Sex>
     406                        <xsl:value-of select=" ./Sex"/>
     407                    </Sex>
     408                    <Education>
     409                        <xsl:value-of select=" ./Education"/>
     410                    </Education>
     411                    <Anonymized>
     412                        <xsl:value-of select=" ./Anonymized"/>
     413                    </Anonymized>
     414                    <xsl:apply-templates select="Contact"/>
    304415                    <xsl:apply-templates select="child::Keys"/>
    305416                    <xsl:if test="exists(child::Description)">
     
    311422                                </Description>
    312423                            </xsl:for-each>
    313                         </descriptions>               
    314                     </xsl:if>
    315                     <xsl:apply-templates select="child::Languages" mode="actor" />
     424                        </descriptions>
     425                    </xsl:if>
     426                    <xsl:apply-templates select="child::Languages" mode="actor"/>
    316427                </Actor>
    317428            </xsl:for-each>
     
    329440                        </Description>
    330441                    </xsl:for-each>
    331                 </descriptions>               
     442                </descriptions>
    332443            </xsl:if>
    333444            <xsl:for-each select="Language">
    334445                <Actor_Language>
    335                     <Id><xsl:value-of select=" ./Id"/></Id>
    336                     <Name><xsl:value-of select=" ./Name"/></Name>
     446                    <Id>
     447                        <xsl:value-of select=" ./Id"/>
     448                    </Id>
     449                    <Name>
     450                        <xsl:value-of select=" ./Name"/>
     451                    </Name>
    337452                    <xsl:if test="exists(child::MotherTongue)">
    338                         <MotherTongue><xsl:value-of select=" ./MotherTongue"/></MotherTongue>
     453                        <MotherTongue>
     454                            <xsl:value-of select=" ./MotherTongue"/>
     455                        </MotherTongue>
    339456                    </xsl:if>
    340457                    <xsl:if test="exists(child::PrimaryLanguage)">
    341                         <PrimaryLanguage><xsl:value-of select=" ./PrimaryLanguage"/></PrimaryLanguage>
     458                        <PrimaryLanguage>
     459                            <xsl:value-of select=" ./PrimaryLanguage"/>
     460                        </PrimaryLanguage>
    342461                    </xsl:if>
    343462                    <xsl:if test="exists(child::Description)">
     
    349468                                </Description>
    350469                            </xsl:for-each>
    351                         </descriptions>               
     470                        </descriptions>
    352471                    </xsl:if>
    353472                </Actor_Language>
    354             </xsl:for-each>           
     473            </xsl:for-each>
    355474        </Actor_Languages>
    356475    </xsl:template>
    357    
     476
    358477
    359478    <xsl:template match="child::Resources" mode="regular">
     
    362481            <xsl:apply-templates select="WrittenResource"/>
    363482            <xsl:apply-templates select="Source"/>
    364             <xsl:apply-templates select="Anonyms"/>           
     483            <xsl:apply-templates select="Anonyms"/>
    365484        </Resources>
    366485    </xsl:template>
    367    
     486
    368487    <xsl:template match="MediaFile">
    369488        <MediaFile ref="{generate-id()}">
    370             <ResourceLink><xsl:value-of select=" ./ResourceLink"/></ResourceLink>
    371             <Type><xsl:value-of select=" ./Type"/></Type>
    372             <Format><xsl:value-of select=" ./Format"/></Format>
    373             <Size><xsl:value-of select=" ./Size"/></Size>
    374             <Quality><xsl:value-of select=" ./Quality"/></Quality>
    375             <RecordingConditions><xsl:value-of select=" ./RecordingConditions"/></RecordingConditions>
     489            <ResourceLink>
     490                <xsl:value-of select=" ./ResourceLink"/>
     491            </ResourceLink>
     492            <Type>
     493                <xsl:value-of select=" ./Type"/>
     494            </Type>
     495            <Format>
     496                <xsl:value-of select=" ./Format"/>
     497            </Format>
     498            <Size>
     499                <xsl:value-of select=" ./Size"/>
     500            </Size>
     501            <Quality>
     502                <xsl:value-of select=" ./Quality"/>
     503            </Quality>
     504            <RecordingConditions>
     505                <xsl:value-of select=" ./RecordingConditions"/>
     506            </RecordingConditions>
    376507            <TimePosition>
    377                 <Start><xsl:apply-templates select="TimePosition/Start"/></Start>
     508                <Start>
     509                    <xsl:apply-templates select="TimePosition/Start"/>
     510                </Start>
    378511                <xsl:if test="exists(descendant::End)">
    379                     <End><xsl:apply-templates select="TimePosition/End"/></End>
     512                    <End>
     513                        <xsl:apply-templates select="TimePosition/End"/>
     514                    </End>
    380515                </xsl:if>
    381516            </TimePosition>
     
    389524                        </Description>
    390525                    </xsl:for-each>
    391                 </descriptions>               
    392             </xsl:if>
    393             <xsl:apply-templates select="child::Keys"/>           
    394         </MediaFile>       
    395     </xsl:template>
    396    
     526                </descriptions>
     527            </xsl:if>
     528            <xsl:apply-templates select="child::Keys"/>
     529        </MediaFile>
     530    </xsl:template>
     531
    397532    <xsl:template match="Access">
    398533        <Access>
    399             <Availability><xsl:value-of select=" ./Availability"/></Availability>
    400             <Date><xsl:value-of select=" ./Date"/></Date>
    401             <Owner><xsl:value-of select=" ./Owner"/></Owner>
    402             <Publisher><xsl:value-of select=" ./Publisher"/></Publisher>
    403             <xsl:apply-templates select="Contact" />
    404             <xsl:if test="exists(child::Description)">
    405                 <descriptions>
    406                     <xsl:for-each select="Description">
    407                         <Description>
    408                             <xsl:attribute name="LanguageId" select="@LanguageId"/>
    409                             <xsl:value-of select="."/>
    410                         </Description>
    411                     </xsl:for-each>
    412                 </descriptions>               
     534            <Availability>
     535                <xsl:value-of select=" ./Availability"/>
     536            </Availability>
     537            <Date>
     538                <xsl:value-of select=" ./Date"/>
     539            </Date>
     540            <Owner>
     541                <xsl:value-of select=" ./Owner"/>
     542            </Owner>
     543            <Publisher>
     544                <xsl:value-of select=" ./Publisher"/>
     545            </Publisher>
     546            <xsl:apply-templates select="Contact"/>
     547            <xsl:if test="exists(child::Description)">
     548                <descriptions>
     549                    <xsl:for-each select="Description">
     550                        <Description>
     551                            <xsl:attribute name="LanguageId" select="@LanguageId"/>
     552                            <xsl:value-of select="."/>
     553                        </Description>
     554                    </xsl:for-each>
     555                </descriptions>
    413556            </xsl:if>
    414557        </Access>
    415558    </xsl:template>
    416    
     559
    417560    <xsl:template match="WrittenResource">
    418561        <WrittenResource ref="{generate-id()}">
    419             <ResourceLink><xsl:value-of select=" ./ResourceLink"/></ResourceLink>
    420             <MediaResourceLink><xsl:value-of select=" ./MediaResourceLink"/></MediaResourceLink>
    421             <Date><xsl:value-of select=" ./Date"/></Date>
    422             <Type><xsl:value-of select=" ./Type"/></Type>
    423             <SubType><xsl:value-of select=" ./SubType"/></SubType>
    424             <Format><xsl:value-of select=" ./Format"/></Format>           
    425             <Size><xsl:value-of select=" ./Size"/></Size>
    426             <Derivation><xsl:value-of select=" ./Derivation"/></Derivation>           
    427             <CharacterEncoding><xsl:value-of select=" ./CharacterEncoding"/></CharacterEncoding>
    428             <ContentEncoding><xsl:value-of select=" ./ContentEncoding"/></ContentEncoding>
    429             <LanguageId><xsl:value-of select=" ./LanguageId"/></LanguageId>
    430             <Anonymized><xsl:value-of select=" ./Anonymized"/></Anonymized>
    431             <xsl:apply-templates select="Validation"/>   
     562            <ResourceLink>
     563                <xsl:value-of select=" ./ResourceLink"/>
     564            </ResourceLink>
     565            <MediaResourceLink>
     566                <xsl:value-of select=" ./MediaResourceLink"/>
     567            </MediaResourceLink>
     568            <Date>
     569                <xsl:value-of select=" ./Date"/>
     570            </Date>
     571            <Type>
     572                <xsl:value-of select=" ./Type"/>
     573            </Type>
     574            <SubType>
     575                <xsl:value-of select=" ./SubType"/>
     576            </SubType>
     577            <Format>
     578                <xsl:value-of select=" ./Format"/>
     579            </Format>
     580            <Size>
     581                <xsl:value-of select=" ./Size"/>
     582            </Size>
     583            <Derivation>
     584                <xsl:value-of select=" ./Derivation"/>
     585            </Derivation>
     586            <CharacterEncoding>
     587                <xsl:value-of select=" ./CharacterEncoding"/>
     588            </CharacterEncoding>
     589            <ContentEncoding>
     590                <xsl:value-of select=" ./ContentEncoding"/>
     591            </ContentEncoding>
     592            <LanguageId>
     593                <xsl:value-of select=" ./LanguageId"/>
     594            </LanguageId>
     595            <Anonymized>
     596                <xsl:value-of select=" ./Anonymized"/>
     597            </Anonymized>
     598            <xsl:apply-templates select="Validation"/>
    432599            <xsl:apply-templates select="Access"/>
    433600            <xsl:if test="exists(child::Description)">
     
    439606                        </Description>
    440607                    </xsl:for-each>
    441                 </descriptions>               
    442             </xsl:if>
    443             <xsl:apply-templates select="Keys"/>       
     608                </descriptions>
     609            </xsl:if>
     610            <xsl:apply-templates select="Keys"/>
    444611        </WrittenResource>
    445612    </xsl:template>
    446    
     613
    447614    <xsl:template match="Validation">
    448615        <Validation>
    449             <Type><xsl:value-of select=" ./Type"/></Type>
    450             <Methodology><xsl:value-of select=" ./Methodology"/></Methodology>
    451             <Level><xsl:value-of select=" ./Level"/></Level>
    452             <xsl:if test="exists(child::Description)">
    453                 <descriptions>
    454                     <xsl:for-each select="Description">
    455                         <Description>
    456                             <xsl:attribute name="LanguageId" select="@LanguageId"/>
    457                             <xsl:value-of select="."/>
    458                         </Description>
    459                     </xsl:for-each>
    460                 </descriptions>               
     616            <Type>
     617                <xsl:value-of select=" ./Type"/>
     618            </Type>
     619            <Methodology>
     620                <xsl:value-of select=" ./Methodology"/>
     621            </Methodology>
     622            <Level>
     623                <xsl:value-of select=" ./Level"/>
     624            </Level>
     625            <xsl:if test="exists(child::Description)">
     626                <descriptions>
     627                    <xsl:for-each select="Description">
     628                        <Description>
     629                            <xsl:attribute name="LanguageId" select="@LanguageId"/>
     630                            <xsl:value-of select="."/>
     631                        </Description>
     632                    </xsl:for-each>
     633                </descriptions>
    461634            </xsl:if>
    462635        </Validation>
    463636    </xsl:template>
    464    
     637
    465638    <xsl:template match="Source">
    466639        <Source>
    467             <Id><xsl:value-of select=" ./Id"/></Id>
    468             <Format><xsl:value-of select=" ./Format"/></Format>           
    469             <Quality><xsl:value-of select=" ./Quality"/></Quality>
     640            <Id>
     641                <xsl:value-of select=" ./Id"/>
     642            </Id>
     643            <Format>
     644                <xsl:value-of select=" ./Format"/>
     645            </Format>
     646            <Quality>
     647                <xsl:value-of select=" ./Quality"/>
     648            </Quality>
    470649            <xsl:if test="exists(child::CounterPosition)">
    471650                <CounterPosition>
    472                     <Start><xsl:apply-templates select="CounterPosition/Start"/></Start>
     651                    <Start>
     652                        <xsl:apply-templates select="CounterPosition/Start"/>
     653                    </Start>
    473654                    <xsl:if test="exists(descendant::End)">
    474                         <End><xsl:apply-templates select="CounterPosition/End"/></End>
     655                        <End>
     656                            <xsl:apply-templates select="CounterPosition/End"/>
     657                        </End>
    475658                    </xsl:if>
    476659                </CounterPosition>
     
    478661            <xsl:if test="exists(child::TimePosition)">
    479662                <TimePosition>
    480                     <Start><xsl:apply-templates select="TimePosition/Start"/></Start>
     663                    <Start>
     664                        <xsl:apply-templates select="TimePosition/Start"/>
     665                    </Start>
    481666                    <xsl:if test="exists(descendant::End)">
    482                         <End><xsl:apply-templates select="TimePosition/End"/></End>
     667                        <End>
     668                            <xsl:apply-templates select="TimePosition/End"/>
     669                        </End>
    483670                    </xsl:if>
    484671                </TimePosition>
     
    493680                        </Description>
    494681                    </xsl:for-each>
    495                 </descriptions>               
     682                </descriptions>
    496683            </xsl:if>
    497684            <xsl:apply-templates select="child::Keys"/>
    498685        </Source>
    499686    </xsl:template>
    500    
     687
    501688    <xsl:template match="Anonyms">
    502689        <Anonyms>
    503             <ResourceLink><xsl:value-of select=" ./ResourceLink"/></ResourceLink>
     690            <ResourceLink>
     691                <xsl:value-of select=" ./ResourceLink"/>
     692            </ResourceLink>
    504693            <xsl:apply-templates select="Access"/>
    505694        </Anonyms>
    506695    </xsl:template>
    507    
     696
    508697    <xsl:template match="child::References">
    509698        <References>
     
    516705                        </Description>
    517706                    </xsl:for-each>
    518                 </descriptions>               
     707                </descriptions>
    519708            </xsl:if>
    520709        </References>
    521710    </xsl:template>
    522    
     711
    523712    <xsl:template name="main">
    524         <xsl:for-each select="collection('file:///tmp/alekoe?select=*.imdi;recurse=yes;on-error=ignore')">
     713        <xsl:for-each
     714            select="collection('file:///tmp/alekoe?select=*.imdi;recurse=yes;on-error=ignore')">
    525715            <xsl:result-document href="{document-uri(.)}.cmdi">
    526716                <xsl:apply-templates select="."/>
    527717            </xsl:result-document>
    528718        </xsl:for-each>
    529     </xsl:template> 
    530    
     719    </xsl:template>
     720
    531721</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.