Changeset 2037
- Timestamp:
- 07/17/12 14:57:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/xslt/imdi2clarin.xsl
r2027 r2037 25 25 <Header> 26 26 <MdCreator>imdi2clarin.xsl</MdCreator> 27 <MdCreationDate><xsl:value-of select="format-date(current-date(), '[Y]-[M01]-[D01]')"/></MdCreationDate> 27 <MdCreationDate> 28 <xsl:value-of select="format-date(current-date(), '[Y]-[M01]-[D01]')"/> 29 </MdCreationDate> 28 30 <MdSelfLink> 29 31 <xsl:choose> 30 <xsl:when test="not($uri-base='') and normalize-space(@ArchiveHandle)=''"> <xsl:value-of select="$uri-base"/></xsl:when>31 <xsl:otherwise>32 test-<xsl:value-of select="@ArchiveHandle"/>33 < /xsl:otherwise>32 <xsl:when test="not($uri-base='') and normalize-space(@ArchiveHandle)=''"> 33 <xsl:value-of select="$uri-base"/> 34 </xsl:when> 35 <xsl:otherwise>test-<xsl:value-of select="@ArchiveHandle"/></xsl:otherwise> 34 36 </xsl:choose> 35 37 </MdSelfLink> … … 38 40 </MdProfile> 39 41 <xsl:if test="$collection"> 40 <MdCollectionDisplayName><xsl:value-of select="$collection"/></MdCollectionDisplayName> 42 <MdCollectionDisplayName> 43 <xsl:value-of select="$collection"/> 44 </MdCollectionDisplayName> 41 45 </xsl:if> 42 46 </Header> … … 44 48 <ResourceProxyList> 45 49 <xsl:apply-templates select="//Resources" mode="linking"/> 50 <xsl:apply-templates select="//Description[not(normalize-space(./@ArchiveHandle)='') or not(normalize-space(./@Link)='')]" mode="linking"/> 46 51 <xsl:apply-templates select="//Corpus" mode="linking"/> 47 52 </ResourceProxyList> … … 61 66 xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1271859438204/xsd"> 62 67 <xsl:call-template name="metatranscriptDelegate"> 63 <xsl:with-param name="profile">clarin.eu:cr1:p_1271859438204</xsl:with-param> 68 <xsl:with-param name="profile" 69 >clarin.eu:cr1:p_1271859438204</xsl:with-param> 64 70 </xsl:call-template> 65 71 </CMD> … … 69 75 xsi:schemaLocation="http://www.clarin.eu/cmd/ http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/clarin.eu:cr1:p_1274880881885/xsd"> 70 76 <xsl:call-template name="metatranscriptDelegate"> 71 <xsl:with-param name="profile">clarin.eu:cr1:p_1274880881885</xsl:with-param> 77 <xsl:with-param name="profile" 78 >clarin.eu:cr1:p_1274880881885</xsl:with-param> 72 79 </xsl:call-template> 73 80 </CMD> … … 75 82 <xsl:otherwise> 76 83 <!-- Currently we are only processing 'SESSION' and 'CORPUS' types. The error displayed can be used to filter out erroneous files after processing--> 77 ERROR: Invalid METATRANSCRIPT Type! 78 </xsl:otherwise> 84 ERROR: Invalid METATRANSCRIPT Type! </xsl:otherwise> 79 85 </xsl:choose> 80 86 </xsl:template> … … 88 94 <xsl:if test="exists(child::Description)"> 89 95 <descriptions> 96 97 <xsl:variable name="reflist"> 98 <xsl:for-each select="Description"> 99 100 <xsl:if test="not(normalize-space(@ArchiveHandle)='') or not(normalize-space(@Link)='')"> 101 <xsl:value-of select="generate-id()"/> 102 <xsl:text> </xsl:text> 103 </xsl:if> 104 105 106 </xsl:for-each> 107 </xsl:variable> 108 109 <xsl:attribute name="ref" select="normalize-space($reflist)"></xsl:attribute> 110 111 112 90 113 <xsl:for-each select="Description"> 91 92 93 94 114 <Description> 115 <xsl:attribute name="LanguageId" select="@LanguageId"/> 116 <xsl:value-of select="."/> 117 </Description> 95 118 </xsl:for-each> 119 96 120 </descriptions> 97 121 </xsl:if> … … 117 141 <ResourceRef> 118 142 <xsl:choose> 119 <xsl:when test="not(normalize-space(./@ArchiveHandle)='')">test-<xsl:value-of select="./@ArchiveHandle"/></xsl:when> 120 <xsl:when test="starts-with(., 'hdl:')"><xsl:value-of select="."/></xsl:when> 143 <xsl:when test="not(normalize-space(./@ArchiveHandle)='')" 144 >test-<xsl:value-of select="./@ArchiveHandle"/></xsl:when> 145 <xsl:when test="starts-with(., 'hdl:')"> 146 <xsl:value-of select="."/> 147 </xsl:when> 121 148 <xsl:when test="$uri-base=''"><xsl:value-of select="."/>.cmdi</xsl:when> 122 <xsl:otherwise><xsl:value-of select="concat(resolve-uri(normalize-space(.), $uri-base), '.cmdi')"/></xsl:otherwise> 149 <xsl:otherwise> 150 <xsl:value-of 151 select="concat(resolve-uri(normalize-space(.), $uri-base), '.cmdi')" 152 /> 153 </xsl:otherwise> 123 154 </xsl:choose> 124 155 </ResourceRef> … … 127 158 </xsl:template> 128 159 160 <!-- Create ResourceProxy for MediaFile and WrittenResource --> 129 161 <xsl:template match="Resources" mode="linking"> 130 162 <xsl:for-each select="MediaFile"> 131 <ResourceProxy id="{generate-id()}"> 132 <ResourceType> 133 <xsl:if test="exists(Format) and not(empty(Format))"> 134 <xsl:attribute name="mimetype"> 135 <xsl:value-of select="./Format"/> 136 </xsl:attribute> 137 </xsl:if>Resource</ResourceType> 138 <ResourceRef> 139 <xsl:choose> 140 <xsl:when test="not(normalize-space(ResourceLink/@ArchiveHandle)='')"><xsl:value-of select="ResourceLink/@ArchiveHandle"/></xsl:when> 141 <xsl:when test="not($uri-base='')"><xsl:value-of select="resolve-uri(normalize-space(ResourceLink/.), $uri-base)"/></xsl:when> 142 </xsl:choose> 143 </ResourceRef> 144 </ResourceProxy> 163 <xsl:call-template name="CreateResourceProxyTypeResource"/> 145 164 </xsl:for-each> 146 165 <xsl:for-each select="WrittenResource"> 147 <ResourceProxy id="{generate-id()}"> 148 <ResourceType> 149 <xsl:if test="exists(Format) and not(empty(Format))"> 150 <xsl:attribute name="mimetype"> 151 <xsl:value-of select="./Format"/> 152 </xsl:attribute> 153 </xsl:if>Resource</ResourceType> 154 <ResourceRef> 155 <xsl:choose> 156 <xsl:when test="not(normalize-space(ResourceLink/@ArchiveHandle)='')"><xsl:value-of select="ResourceLink/@ArchiveHandle"/></xsl:when> 157 <xsl:when test="not($uri-base='')"><xsl:value-of select="resolve-uri(normalize-space(ResourceLink/.), $uri-base)"/></xsl:when> 158 </xsl:choose> 159 </ResourceRef> 160 </ResourceProxy> 166 <xsl:call-template name="CreateResourceProxyTypeResource"/> 161 167 </xsl:for-each> 162 168 </xsl:template> 169 170 <!-- Create ResourceProxy for Info files --> 171 <xsl:template match="//Description[@ArchiveHandle or @Link]" mode="linking"> 172 <xsl:call-template name="CreateResourceProxyTypeResource"/> 173 </xsl:template> 174 175 <!-- to be called during the creation of the ResourceProxyList (in linking mode) --> 176 <xsl:template name="CreateResourceProxyTypeResource"> 177 <ResourceProxy id="{generate-id()}"> 178 <ResourceType> 179 <xsl:if test="exists(Format) and not(empty(Format))"> 180 <xsl:attribute name="mimetype"> 181 <xsl:value-of select="./Format"/> 182 </xsl:attribute> 183 </xsl:if>Resource</ResourceType> 184 <ResourceRef> 185 <xsl:choose> 186 <xsl:when test="not(normalize-space(ResourceLink/@ArchiveHandle)='')"> 187 <xsl:value-of select="ResourceLink/@ArchiveHandle"/> 188 </xsl:when> 189 <xsl:when test="not($uri-base='')"> 190 <xsl:value-of 191 select="resolve-uri(normalize-space(ResourceLink/.), $uri-base)"/> 192 </xsl:when> 193 <!-- for info files the @ArchiveHandle or @Link is part of the Description element - preference for ArchiveHandle --> 194 <xsl:when test="not(normalize-space(@ArchiveHandle)='')"> 195 <xsl:value-of select="@ArchiveHandle"/> 196 </xsl:when> 197 <xsl:when test="not(normalize-space(@Link)='')"> 198 <xsl:value-of select="@Link"/> 199 </xsl:when> 200 </xsl:choose> 201 </ResourceRef> 202 </ResourceProxy> 203 </xsl:template> 204 205 163 206 164 207 <xsl:template match="Session"> … … 170 213 <descriptions> 171 214 <xsl:for-each select="Description"> 215 <xsl:if test="@ArchiveHandle"> 216 <xsl:attribute name="ref" select="generate-id()"/> 217 </xsl:if> 172 218 <Description> 173 219 <xsl:attribute name="LanguageId" select="@LanguageId"/>
Note: See TracChangeset
for help on using the changeset viewer.