Changeset 6683
- Timestamp:
- 10/17/15 07:12:51 (9 years ago)
- Location:
- metadata/trunk/toolkit/src
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/src/main/resources/toolkit/upgrade/cmd-record-1_1-to-1_2.xsl
r6262 r6683 17 17 <xsl:variable name="cr-profiles" select="concat($cr-uri,'/profiles')"/> 18 18 <xsl:variable name="cr-extension-xsd" select="'-1_2.xsd'"/> 19 19 <xsl:variable name="cr-extension-xml" select="'.xml'"/> 20 20 21 <!-- identity copy --> 21 22 <xsl:template match="@*|node()"> … … 57 58 <xsl:variable name="cmd-profile-uri" select="concat($cmd-profiles,'/',$profile)"/> 58 59 <xsl:variable name="cr-profile-xsd" select="concat($cr-profiles,'/',$profile,$cr-extension-xsd)"/> 60 <xsl:variable name="cr-profile-xml" select="concat($cr-profiles,'/',$profile,$cr-extension-xml)"/> 59 61 60 62 <!-- CMD version becomes 1.2 --> … … 146 148 147 149 <!-- move CMD attributes to the CMD namespace --> 148 <!-- TODO: @ref is allowed on elements, how to know if this is a element or a component with no children? -->149 <!--<xsl:template match="cmd0:Components//*[exists(*)]/@ref">-->150 150 <xsl:template match="cmd0:Components//@ref"> 151 <xsl:attribute name="cmd:ref" select="."/> 151 <xsl:choose> 152 <xsl:when test="exists(parent::*/text()[normalize-space()!=''])"> 153 <!-- this is an element keep the @ref --> 154 <xsl:copy/> 155 </xsl:when> 156 <xsl:when test="exists(../parent::*/node()) or exists(../parent::*/@ComponentId)"> 157 <!-- the parent is a component add the namespace to @ref --> 158 <xsl:attribute name="cmd:ref" select="."/> 159 </xsl:when> 160 <xsl:otherwise> 161 <!-- don't know if the parent is a component without children, or an element without value 162 have a look at the profile --> 163 <xsl:variable name="prof" select="doc(resolve-uri($cr-profile-xml,base-uri()))"/> 164 <xsl:variable name="path" select="ancestor::*[. >> /cmd0:CMD/cmd0:Components]"/> 165 <xsl:variable name="attr" select="$prof//Attribute[Name='ref'][string-join(ancestor::*[local-name()=('CMD_Component','CMD_Element')]/@name,'/')=string-join($path/local-name(),'/')]"/> 166 <xsl:choose> 167 <xsl:when test="exists($attr/parent::AttributeList/parent::CMD_Component)"> 168 <!-- the parent is a component add the namespace to @ref --> 169 <xsl:message>!MENZO: the parent is a component add the namespace to @ref</xsl:message> 170 <xsl:attribute name="cmd:ref" select="."/> 171 </xsl:when> 172 <xsl:otherwise> 173 <!-- this is an element keep the @ref --> 174 <xsl:message>!MENZO: the parent is an element keep the @ref</xsl:message> 175 <xsl:copy/> 176 </xsl:otherwise> 177 </xsl:choose> 178 </xsl:otherwise> 179 </xsl:choose> 152 180 </xsl:template> 153 181 -
metadata/trunk/toolkit/src/main/resources/toolkit/xsd/cmd-envelop.xsd
r6255 r6683 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" 3 xmlns:cmd="http://www.clarin.eu/cmd/1" targetNamespace="http://www.clarin.eu/cmd/1" 4 elementFormDefault="qualified" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" 5 vc:minVersion="1.0" vc:maxVersion="1.1"> 2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" xmlns:cmd="http://www.clarin.eu/cmd/1" targetNamespace="http://www.clarin.eu/cmd/1" elementFormDefault="qualified" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.0" vc:maxVersion="1.1"> 6 3 <!-- globally declare attributes, so they have to be qualified --> 7 4 <xs:attribute name="ref" type="xs:IDREF"/> … … 13 10 <xs:enumeration value="Metadata"> 14 11 <xs:annotation> 15 <xs:documentation>The ResourceProxy refers to another component metadata 16 instance (e.g. for grouping metadata descriptions into 17 collections)</xs:documentation> 12 <xs:documentation>The ResourceProxy refers to another component metadata instance (e.g. for grouping metadata descriptions into collections)</xs:documentation> 18 13 </xs:annotation> 19 14 </xs:enumeration> 20 15 <xs:enumeration value="Resource"> 21 16 <xs:annotation> 22 <xs:documentation>The ResourceProxy refers to a file that is not a metadata 23 instance (e.g. a text document)</xs:documentation> 17 <xs:documentation>The ResourceProxy refers to a file that is not a metadata instance (e.g. a text document)</xs:documentation> 24 18 </xs:annotation> 25 19 </xs:enumeration> 26 20 <xs:enumeration value="SearchService"> 27 21 <xs:annotation> 28 <xs:documentation>The ResourceProxy refers to a (SRU/CQL) web service that can 29 be used to query the resource described in this file</xs:documentation> 22 <xs:documentation>The ResourceProxy refers to a (SRU/CQL) web service that can be used to query the resource described in this file</xs:documentation> 30 23 </xs:annotation> 31 24 </xs:enumeration> 32 25 <xs:enumeration value="SearchPage"> 33 26 <xs:annotation> 34 <xs:documentation>The ResourceProxy refers to a web page that can be used to 35 query the resource described in this file</xs:documentation> 27 <xs:documentation>The ResourceProxy refers to a web page that can be used to query the resource described in this file</xs:documentation> 36 28 </xs:annotation> 37 29 </xs:enumeration> 38 30 <xs:enumeration value="LandingPage"> 39 31 <xs:annotation> 40 <xs:documentation>The ResourceProxy refers to a web page that contains the 41 "original context" of the resource described in this file (e.g. repository 42 web page displaying the metadata).</xs:documentation> 32 <xs:documentation>The ResourceProxy refers to a web page that contains the "original context" of the resource described in this file (e.g. repository web page displaying the metadata).</xs:documentation> 43 33 </xs:annotation> 44 34 </xs:enumeration> … … 57 47 <xs:simpleContent> 58 48 <xs:extension base="xs:string"> 59 <xs:anyAttribute namespace="##other" 60 processContents="lax"/> 49 <xs:anyAttribute namespace="##other" processContents="lax"/> 61 50 </xs:extension> 62 51 </xs:simpleContent> … … 67 56 <xs:simpleContent> 68 57 <xs:extension base="xs:date"> 69 <xs:anyAttribute namespace="##other" 70 processContents="lax"/> 58 <xs:anyAttribute namespace="##other" processContents="lax"/> 71 59 </xs:extension> 72 60 </xs:simpleContent> … … 77 65 <xs:simpleContent> 78 66 <xs:extension base="xs:anyURI"> 79 <xs:anyAttribute namespace="##other" 80 processContents="lax"/> 67 <xs:anyAttribute namespace="##other" processContents="lax"/> 81 68 </xs:extension> 82 69 </xs:simpleContent> … … 87 74 <xs:simpleContent> 88 75 <xs:extension base="xs:anyURI"> 89 <xs:anyAttribute namespace="##other" 90 processContents="lax"/> 76 <xs:anyAttribute namespace="##other" processContents="lax"/> 91 77 </xs:extension> 92 78 </xs:simpleContent> … … 97 83 <xs:simpleContent> 98 84 <xs:extension base="xs:string"> 99 <xs:anyAttribute namespace="##other" 100 processContents="lax"/> 85 <xs:anyAttribute namespace="##other" processContents="lax"/> 101 86 </xs:extension> 102 87 </xs:simpleContent> … … 113 98 <xs:complexType> 114 99 <xs:sequence> 115 <xs:element name="ResourceProxy" minOccurs="0" 116 maxOccurs="unbounded"> 100 <xs:element name="ResourceProxy" minOccurs="0" maxOccurs="unbounded"> 117 101 <xs:complexType> 118 102 <xs:sequence> 119 <xs:element name="ResourceType" minOccurs="1" 120 maxOccurs="1"> 121 <xs:complexType> 122 <xs:simpleContent> 123 <xs:extension base="cmd:Resourcetype_simple"> 124 <xs:attribute name="mimetype" type="xs:string"/> 125 <xs:anyAttribute namespace="##other" 126 processContents="lax"/> 127 </xs:extension> 128 </xs:simpleContent> 129 </xs:complexType> 130 </xs:element> 131 <xs:element name="ResourceRef" minOccurs="1" 132 maxOccurs="1"> 133 <xs:complexType> 134 <xs:simpleContent> 135 <xs:extension base="xs:anyURI"> 136 <xs:anyAttribute namespace="##other" 137 processContents="lax"/> 138 </xs:extension> 139 </xs:simpleContent> 140 </xs:complexType> 141 </xs:element> 103 <xs:element name="ResourceType" minOccurs="1" maxOccurs="1"> 104 <xs:complexType> 105 <xs:simpleContent> 106 <xs:extension base="cmd:Resourcetype_simple"> 107 <xs:attribute name="mimetype" type="xs:string"/> 108 <xs:anyAttribute namespace="##other" processContents="lax"/> 109 </xs:extension> 110 </xs:simpleContent> 111 </xs:complexType> 112 </xs:element> 113 <xs:element name="ResourceRef" minOccurs="1" maxOccurs="1"> 114 <xs:complexType> 115 <xs:simpleContent> 116 <xs:extension base="xs:anyURI"> 117 <xs:anyAttribute namespace="##other" processContents="lax"/> 118 </xs:extension> 119 </xs:simpleContent> 120 </xs:complexType> 121 </xs:element> 142 122 </xs:sequence> 143 123 <xs:attribute name="id" type="xs:ID" use="required"/> 144 <xs:anyAttribute namespace="##other" 145 processContents="lax"/> 124 <xs:anyAttribute namespace="##other" processContents="lax"/> 146 125 </xs:complexType> 147 126 </xs:element> … … 153 132 <xs:complexType> 154 133 <xs:sequence> 155 <xs:element name="JournalFileProxy" minOccurs="0" 156 maxOccurs="unbounded"> 134 <xs:element name="JournalFileProxy" minOccurs="0" maxOccurs="unbounded"> 157 135 <xs:complexType> 158 136 <xs:sequence> 159 <xs:element name="JournalFileRef" minOccurs="1" 160 maxOccurs="1"> 161 <xs:complexType> 162 <xs:simpleContent> 163 <xs:extension base="xs:anyURI"> 164 <xs:anyAttribute namespace="##other" 165 processContents="lax"/> 166 </xs:extension> 167 </xs:simpleContent> 168 </xs:complexType> 169 </xs:element> 137 <xs:element name="JournalFileRef" minOccurs="1" maxOccurs="1"> 138 <xs:complexType> 139 <xs:simpleContent> 140 <xs:extension base="xs:anyURI"> 141 <xs:anyAttribute namespace="##other" processContents="lax"/> 142 </xs:extension> 143 </xs:simpleContent> 144 </xs:complexType> 145 </xs:element> 170 146 </xs:sequence> 171 <xs:anyAttribute namespace="##other" 172 processContents="lax"/> 147 <xs:anyAttribute namespace="##other" processContents="lax"/> 173 148 </xs:complexType> 174 149 </xs:element> … … 181 156 <xs:complexType> 182 157 <xs:sequence> 183 <xs:element name="ResourceRelation" minOccurs="0" 184 maxOccurs="unbounded"> 158 <xs:element name="ResourceRelation" minOccurs="0" maxOccurs="unbounded"> 185 159 <xs:complexType> 186 160 <xs:sequence> 187 <xs:element name="RelationType" minOccurs="1" 188 maxOccurs="1"> 189 <xs:complexType> 190 <xs:simpleContent> 191 <xs:extension base="xs:string"> 192 <xs:attribute name="ConceptLink" type="xs:anyURI" 193 use="optional"/> 194 <xs:anyAttribute namespace="##other" 195 processContents="lax"/> 196 </xs:extension> 197 </xs:simpleContent> 198 </xs:complexType> 199 </xs:element> 200 <xs:element name="Resource" minOccurs="2" 201 maxOccurs="2"> 202 <xs:complexType> 203 <xs:sequence> 204 <xs:element name="Role" minOccurs="0" 205 maxOccurs="1"> 206 <xs:complexType> 207 <xs:simpleContent> 208 <xs:extension base="xs:string"> 209 <xs:attribute name="ConceptLink" type="xs:anyURI" 210 use="optional"/> 211 <xs:anyAttribute namespace="##other" 212 processContents="lax"/> 213 </xs:extension> 214 </xs:simpleContent> 215 </xs:complexType> 216 </xs:element> 217 </xs:sequence> 218 <xs:attribute name="ref" type="xs:IDREF" 219 use="required"/> 220 <xs:anyAttribute namespace="##other" 221 processContents="lax"/> 222 </xs:complexType> 223 </xs:element> 161 <xs:element name="RelationType" minOccurs="1" maxOccurs="1"> 162 <xs:complexType> 163 <xs:simpleContent> 164 <xs:extension base="xs:string"> 165 <xs:attribute name="ConceptLink" type="xs:anyURI" use="optional"/> 166 <xs:anyAttribute namespace="##other" processContents="lax"/> 167 </xs:extension> 168 </xs:simpleContent> 169 </xs:complexType> 170 </xs:element> 171 <xs:element name="Resource" minOccurs="2" maxOccurs="2"> 172 <xs:complexType> 173 <xs:sequence> 174 <xs:element name="Role" minOccurs="0" maxOccurs="1"> 175 <xs:complexType> 176 <xs:simpleContent> 177 <xs:extension base="xs:string"> 178 <xs:attribute name="ConceptLink" type="xs:anyURI" use="optional"/> 179 <xs:anyAttribute namespace="##other" processContents="lax"/> 180 </xs:extension> 181 </xs:simpleContent> 182 </xs:complexType> 183 </xs:element> 184 </xs:sequence> 185 <xs:attribute name="ref" type="xs:IDREF" use="required"/> 186 <xs:anyAttribute namespace="##other" processContents="lax"/> 187 </xs:complexType> 188 </xs:element> 224 189 </xs:sequence> 225 <xs:anyAttribute namespace="##other" 226 processContents="lax"/> 190 <xs:anyAttribute namespace="##other" processContents="lax"/> 227 191 </xs:complexType> 228 192 </xs:element>
Note: See TracChangeset
for help on using the changeset viewer.