- Timestamp:
- 11/20/13 18:16:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/xslt/imdi2clarin.xsl
r3378 r4064 4 4 $LastChangedDate$ 5 5 --> 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"/> 26 81 27 82 <!-- 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 32 99 <Header> 33 <MdCreator> imdi2clarin.xsl</MdCreator>100 <MdCreator><xsl:text>imdi2clarin.xsl</xsl:text></MdCreator> 34 101 <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]')"/> 36 104 </MdCreationDate> 37 105 <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"/> 46 108 </MdSelfLink> 47 109 <MdProfile> 48 <xsl:value-of select="$profile"/> 110 <xsl:value-of 111 select="$profile"/> 49 112 </MdProfile> 50 <xsl:if test="$collection"> 113 <xsl:if 114 test="not(normalize-space($collection)='')"> 51 115 <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> 53 128 </MdCollectionDisplayName> 54 129 </xsl:if> … … 56 131 <Resources> 57 132 <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"/> 61 175 <!-- 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> 67 182 </xsl:if> 68 183 </ResourceProxyList> … … 71 186 </Resources> 72 187 <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"/> 75 192 </Components> 76 193 </xsl:template> 77 194 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"/> 79 202 <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> 97 239 </xsl:when> 98 240 <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> 101 286 </xsl:choose> 102 287 </xsl:template> 103 288 104 105 <xsl:templatematch="Corpus">289 <xsl:template 290 match="Corpus"> 106 291 <imdi-corpus> 107 292 <Corpus> … … 145 330 </xsl:template> 146 331 147 <xsl:template match="Corpus" mode="linking"> 332 <xsl:template 333 match="Corpus" mode="linking"> 148 334 <xsl:for-each select="CorpusLink"> 149 335 <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> 158 337 <ResourceRef> 159 338 <xsl:choose> 160 <!-- Check for archive handle attribute -->161 339 <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"/> 168 341 </xsl:when> 169 <!-- Is link a handle? -->170 342 <xsl:when test="starts-with(., 'hdl:')"> 171 343 <xsl:value-of select="."/> 172 344 </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> 175 346 <xsl:otherwise> 176 347 <xsl:value-of 177 select="concat(resolve-uri(normalize-space(.), $uri-base), '.cmdi')" 178 /> 348 select="concat(resolve-uri(normalize-space(.), $uri-base), '.cmdi')"/> 179 349 </xsl:otherwise> 180 350 </xsl:choose> … … 185 355 186 356 <!-- Create ResourceProxy for MediaFile and WrittenResource --> 187 <xsl:template match="Resources" mode="linking"> 357 <xsl:template 358 match="Resources" 359 mode="linking"> 188 360 <xsl:for-each select="MediaFile"> 189 <xsl:call-template name="CreateResourceProxyTypeResource"/> 361 <xsl:call-template 362 name="CreateResourceProxyTypeResource"/> 190 363 </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"/> 193 368 </xsl:for-each> 194 369 </xsl:template> 195 370 196 371 <!-- 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"/> 199 377 </xsl:template> 200 378 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"> 203 382 <ResourceProxy id="{generate-id()}"> 204 383 <ResourceType> … … 207 386 <xsl:value-of select="./Format"/> 208 387 </xsl:attribute> 209 </xsl:if>Resource</ResourceType> 388 </xsl:if> 389 <xsl:text>Resource</xsl:text> 390 </ResourceType> 210 391 <ResourceRef> 211 392 <xsl:choose> … … 228 409 </ResourceProxy> 229 410 </xsl:template> 230 231 232 233 <xsl:template match="Session"> 411 412 <xsl:template 413 match="Session"> 234 414 <Session> 235 415 <xsl:apply-templates select="child::Name"/> … … 265 445 </xsl:template> 266 446 267 <xsl:template match="child::Name"> 447 <xsl:template 448 match="child::Name"> 268 449 <Name> 269 450 <xsl:value-of select="."/> … … 271 452 </xsl:template> 272 453 273 <xsl:template match="child::Title"> 454 <xsl:template 455 match="child::Title"> 274 456 <Title> 275 457 <xsl:value-of select="."/> … … 277 459 </xsl:template> 278 460 279 <xsl:template match="child::Date"> 461 <xsl:template 462 match="child::Date"> 280 463 <Date> 281 464 <xsl:value-of select="."/> … … 283 466 </xsl:template> 284 467 285 <xsl:template match="child::MDGroup"> 468 <xsl:template 469 match="child::MDGroup"> 286 470 <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"/> 292 481 </MDGroup> 293 482 </xsl:template> 294 483 295 <xsl:template match="Location"> 484 <xsl:template 485 match="Location"> 296 486 <Location> 297 487 <Continent> 298 <xsl:value-of select="child::Continent"/> 488 <xsl:value-of 489 select="child::Continent"/> 299 490 </Continent> 300 491 <Country> 301 <xsl:value-of select="child::Country"/> 492 <xsl:value-of 493 select="child::Country"/> 302 494 </Country> 303 <xsl:if test="exists(child::Region)"> 495 <xsl:if 496 test="exists(child::Region)"> 304 497 <Region> 305 <xsl:value-of select="child::Region"/> 498 <xsl:value-of 499 select="child::Region"/> 306 500 </Region> 307 501 </xsl:if> 308 <xsl:if test="exists(child::Address)"> 502 <xsl:if 503 test="exists(child::Address)"> 309 504 <Address> 310 <xsl:value-of select="child::Address"/> 505 <xsl:value-of 506 select="child::Address"/> 311 507 </Address> 312 508 </xsl:if> … … 314 510 </xsl:template> 315 511 316 <xsl:template match="Project"> 512 <xsl:template 513 match="Project"> 317 514 <Project> 318 515 <Name> … … 330 527 <xsl:for-each select="Description"> 331 528 <Description> 332 <xsl:attribute name="LanguageId" select="@LanguageId"/> 529 <xsl:attribute 530 name="LanguageId" 531 select="@LanguageId"/> 333 532 <xsl:value-of select="."/> 334 533 </Description> … … 339 538 </xsl:template> 340 539 341 <xsl:template match="Contact"> 540 <xsl:template 541 match="Contact"> 342 542 <Contact> 343 543 <Name> … … 356 556 </xsl:template> 357 557 358 <xsl:template match="Keys"> 558 <xsl:template 559 match="Keys"> 359 560 <Keys> 360 561 <xsl:for-each select="Key"> … … 369 570 </xsl:template> 370 571 371 <xsl:template match="Content"> 572 <xsl:template 573 match="Content"> 372 574 <Content> 373 575 <Genre> … … 411 613 </xsl:template> 412 614 413 <xsl:template match="CommunicationContext"> 615 <xsl:template 616 match="CommunicationContext"> 414 617 <CommunicationContext> 415 618 <xsl:if test="exists(child::Interactivity)"> … … 446 649 </xsl:template> 447 650 448 <xsl:template match="Languages" mode="content"> 651 <xsl:template 652 match="Languages" 653 mode="content"> 449 654 <Content_Languages> 450 655 <xsl:if test="exists(child::Description)"> 451 656 <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"> 461 671 <Content_Language> 462 672 <Id> 463 <xsl:value-of select=" ./Id"/> 673 <xsl:value-of 674 select=" ./Id"/> 464 675 </Id> 465 676 <Name> 466 <xsl:value-of select=" ./Name"/> 677 <xsl:value-of 678 select=" ./Name"/> 467 679 </Name> 468 <xsl:if test="exists(child::Dominant)"> 680 <xsl:if 681 test="exists(child::Dominant)"> 469 682 <Dominant> 470 <xsl:value-of select=" ./Dominant"/> 683 <xsl:value-of 684 select=" ./Dominant"/> 471 685 </Dominant> 472 686 </xsl:if> 473 <xsl:if test="exists(child::SourceLanguage)"> 687 <xsl:if 688 test="exists(child::SourceLanguage)"> 474 689 <SourceLanguage> 475 <xsl:value-of select=" ./SourceLanguage"/> 690 <xsl:value-of 691 select=" ./SourceLanguage"/> 476 692 </SourceLanguage> 477 693 </xsl:if> 478 <xsl:if test="exists(child::TargetLanguage)"> 694 <xsl:if 695 test="exists(child::TargetLanguage)"> 479 696 <TargetLanguage> 480 <xsl:value-of select=" ./TargetLanguage"/> 697 <xsl:value-of 698 select=" ./TargetLanguage"/> 481 699 </TargetLanguage> 482 700 </xsl:if> 483 <xsl:if test="exists(child::Description)"> 701 <xsl:if 702 test="exists(child::Description)"> 484 703 <descriptions> 485 <xsl:for-each select="Description"> 704 <xsl:for-each 705 select="Description"> 486 706 <Description> 487 <xsl:attribute name="LanguageId" select="@LanguageId"/> 707 <xsl:attribute 708 name="LanguageId" 709 select="@LanguageId"/> 488 710 <xsl:value-of select="."/> 489 711 </Description> … … 496 718 </xsl:template> 497 719 498 <xsl:template match="Actors"> 720 <xsl:template 721 match="Actors"> 499 722 <Actors> 500 723 <xsl:if test="exists(child::Description)"> … … 561 784 </xsl:template> 562 785 563 <xsl:template match="Languages" mode="actor"> 786 <xsl:template 787 match="Languages" 788 mode="actor"> 564 789 <Actor_Languages> 565 790 <xsl:if test="exists(child::Description)"> … … 606 831 </xsl:template> 607 832 608 609 <xsl:template match="child::Resources" mode="regular"> 833 <xsl:template 834 match="child::Resources" 835 mode="regular"> 610 836 <Resources> 611 837 <xsl:apply-templates select="MediaFile"/> … … 616 842 </xsl:template> 617 843 618 <xsl:template match="MediaFile"> 619 <MediaFile ref="{generate-id()}"> 844 <xsl:template 845 match="MediaFile"> 846 <MediaFile 847 ref="{generate-id()}"> 620 848 <ResourceLink> 621 <xsl:value-of select=" ./ResourceLink"/> 849 <xsl:value-of 850 select=" ./ResourceLink"/> 622 851 </ResourceLink> 623 852 <Type> 624 <xsl:value-of select=" ./Type"/> 853 <xsl:value-of 854 select=" ./Type"/> 625 855 </Type> 626 856 <Format> 627 <xsl:value-of select=" ./Format"/> 857 <xsl:value-of 858 select=" ./Format"/> 628 859 </Format> 629 860 <Size> 630 <xsl:value-of select=" ./Size"/> 861 <xsl:value-of 862 select=" ./Size"/> 631 863 </Size> 632 864 <Quality> 633 <xsl:value-of select=" ./Quality"/> 865 <xsl:value-of 866 select=" ./Quality"/> 634 867 </Quality> 635 868 <RecordingConditions> 636 <xsl:value-of select=" ./RecordingConditions"/> 869 <xsl:value-of 870 select=" ./RecordingConditions"/> 637 871 </RecordingConditions> 638 872 <TimePosition> 639 873 <Start> 640 <xsl:apply-templates select="TimePosition/Start"/> 874 <xsl:apply-templates 875 select="TimePosition/Start"/> 641 876 </Start> 642 877 <xsl:if test="exists(descendant::End)"> 643 878 <End> 644 <xsl:apply-templates select="TimePosition/End"/> 879 <xsl:apply-templates 880 select="TimePosition/End"/> 645 881 </End> 646 882 </xsl:if> … … 651 887 <xsl:for-each select="Description"> 652 888 <Description> 653 <xsl:attribute name="LanguageId" select="@LanguageId"/> 889 <xsl:attribute 890 name="LanguageId" 891 select="@LanguageId"/> 654 892 <xsl:value-of select="."/> 655 893 </Description> … … 661 899 </xsl:template> 662 900 663 <xsl:template match="Access"> 901 <xsl:template 902 match="Access"> 664 903 <Access> 665 904 <Availability> … … 689 928 </xsl:template> 690 929 691 <xsl:template match="WrittenResource"> 930 <xsl:template 931 match="WrittenResource"> 692 932 <WrittenResource ref="{generate-id()}"> 693 933 <ResourceLink> … … 733 973 <xsl:for-each select="Description"> 734 974 <Description> 735 <xsl:attribute name="LanguageId" select="@LanguageId"/> 975 <xsl:attribute 976 name="LanguageId" 977 select="@LanguageId"/> 736 978 <xsl:value-of select="."/> 737 979 </Description> … … 743 985 </xsl:template> 744 986 745 <xsl:template match="Validation"> 987 <xsl:template 988 match="Validation"> 746 989 <Validation> 747 990 <Type> … … 767 1010 </xsl:template> 768 1011 769 <xsl:template match="Source"> 1012 <xsl:template 1013 match="Source"> 770 1014 <Source> 771 1015 <Id> … … 817 1061 </xsl:template> 818 1062 819 <xsl:template match="Anonyms"> 1063 <xsl:template 1064 match="Anonyms"> 820 1065 <Anonyms> 821 1066 <ResourceLink> … … 826 1071 </xsl:template> 827 1072 828 <xsl:template match="child::References"> 1073 <xsl:template 1074 match="child::References"> 829 1075 <References> 830 1076 <xsl:if test="exists(child::Description)"> … … 841 1087 </xsl:template> 842 1088 843 <xsl:template name="main"> 1089 <xsl:template 1090 name="main"> 844 1091 <xsl:for-each 845 1092 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.