Changeset 6907 for metadata/trunk/toolkit/src/main
- Timestamp:
- 01/14/16 12:05:44 (9 years ago)
- Location:
- metadata/trunk/toolkit/src/main/resources/toolkit
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/src/main/resources/toolkit/downgrade/cmd-component-1_2-to-1_1.xsl
r6904 r6907 8 8 9 9 <xsl:param name="cmd-component-xsd" select="'http://infra.clarin.eu/cmd/general-component-schema.xsd'"/> 10 11 <xsl:param name="escape" select="'ccmmddii_'"/> 10 12 11 13 <!-- identity copy --> … … 80 82 <!-- turn Attribute child elements into attributes --> 81 83 <xsl:template match="Attribute" priority="1"> 82 <xsl:choose> 83 <xsl:when test="exists(parent::AttributeList/parent::Component) and Name=('ref','ComponentId')"> 84 <xsl:message>WRN: user-defined ref and ComponentId attributes for a Component are not supported by CMDI 1.1!</xsl:message> 85 </xsl:when> 86 <xsl:otherwise> 87 <Attribute> 88 <Name> 89 <xsl:value-of select="@name"/> 90 </Name> 91 <xsl:if test="normalize-space(@ConceptLink)!=''"> 92 <ConceptLink> 93 <xsl:value-of select="@ConceptLink"/> 94 </ConceptLink> 95 </xsl:if> 96 <xsl:if test="normalize-space(@ValueScheme)!=''"> 97 <Type> 98 <xsl:value-of select="@ValueScheme"/> 99 </Type> 100 </xsl:if> 101 <!-- @Required is skipped --> 102 <xsl:apply-templates select="node()"/> 103 </Attribute> 104 </xsl:otherwise> 105 </xsl:choose> 84 <xsl:variable name="name"> 85 <xsl:choose> 86 <xsl:when test="exists(parent::AttributeList/parent::Component) and Name=('ref','ComponentId')"> 87 <xsl:message>WRN: user-defined ref and ComponentId attributes for a Component are not supported by CMDI 1.1! Adding the <xsl:value-of select="$escape"/> prefix</xsl:message> 88 <xsl:value-of select="concat($escape,@name)"/> 89 </xsl:when> 90 <xsl:otherwise> 91 <xsl:value-of select="@name"/> 92 </xsl:otherwise> 93 </xsl:choose> 94 </xsl:variable> 95 <Attribute> 96 <Name> 97 <xsl:value-of select="$name"/> 98 </Name> 99 <xsl:if test="normalize-space(@ConceptLink)!=''"> 100 <ConceptLink> 101 <xsl:value-of select="@ConceptLink"/> 102 </ConceptLink> 103 </xsl:if> 104 <xsl:if test="normalize-space(@ValueScheme)!=''"> 105 <Type> 106 <xsl:value-of select="@ValueScheme"/> 107 </Type> 108 </xsl:if> 109 <!-- @Required is skipped --> 110 <xsl:apply-templates select="node()"/> 111 </Attribute> 106 112 </xsl:template> 107 113 -
metadata/trunk/toolkit/src/main/resources/toolkit/upgrade/cmd-record-1_1-to-1_2.xsl
r6751 r6907 12 12 <xsl:param name="cmd-uri" select="'http://www.clarin.eu/cmd/1'"/> 13 13 <xsl:param name="cr-uri" select="'..'"/> 14 <xsl:param name="cr-extension-xsd" select="'-1_2.xsd'"/> 15 <xsl:param name="cr-extension-xml" select="'.xml'"/> 16 17 <xsl:param name="escape" select="'ccmmddii_'"/> 14 18 15 19 <xsl:variable name="cmd-components" select="concat($cmd-uri,'/components')"/> 16 20 <xsl:variable name="cmd-profiles" select="concat($cmd-uri,'/profiles')"/> 17 21 <xsl:variable name="cr-profiles" select="concat($cr-uri,'/profiles')"/> 18 <xsl:variable name="cr-extension-xsd" select="'-1_2.xsd'"/>19 <xsl:variable name="cr-extension-xml" select="'.xml'"/>20 22 21 23 <!-- identity copy --> … … 147 149 </xsl:template> 148 150 151 <!-- unescape downgraded CMDI 1.2 attributes --> 152 <xsl:template match="cmd0:Components//@*[name()=local-name()][starts-with(name(),$escape)]"> 153 <xsl:attribute name="{substring-after(name(),$escape)}" select="."/> 154 </xsl:template> 155 149 156 <!-- move CMD attributes to the CMD namespace --> 150 <xsl:template match="cmd0:Components//@ref" >157 <xsl:template match="cmd0:Components//@ref" priority="2"> 151 158 <xsl:choose> 152 159 <xsl:when test="exists(parent::*/text()[normalize-space()!=''])"> … … 158 165 <!-- the parent is a component add the namespace to @ref --> 159 166 <!--<xsl:message>INF: this is an component add the namespace to ref</xsl:message>--> 160 <xsl:attribute name="cmd:ref" select="."/> 167 <xsl:attribute name="cmd:ref"> 168 <xsl:variable name="refs" select="tokenize(.,'\s+')"/> 169 <xsl:if test="count($refs) gt 1"> 170 <xsl:message>WRN: CMDI 1.2 doesn't support references to multiple ResourceProxies! Only the first reference is kept.</xsl:message> 171 </xsl:if> 172 <xsl:value-of select="$refs[1]"/> 173 </xsl:attribute> 161 174 </xsl:when> 162 175 <xsl:otherwise> … … 175 188 <!-- this is an undeclared @ref, so add the namespace --> 176 189 <!--<xsl:message>INF: according to the profile this @ref is not user defined, so add the namespace</xsl:message>--> 177 <xsl:attribute name="cmd:ref" select="."/> 190 <xsl:attribute name="cmd:ref"> 191 <xsl:variable name="refs" select="tokenize(.,'\s+')"/> 192 <xsl:if test="count($refs) gt 1"> 193 <xsl:message>WRN: CMDI 1.2 doesn't support references to multiple ResourceProxies! Only the first reference is kept.</xsl:message> 194 </xsl:if> 195 <xsl:value-of select="$refs[1]"/> 196 </xsl:attribute> 178 197 </xsl:otherwise> 179 198 </xsl:choose> … … 182 201 </xsl:template> 183 202 184 <xsl:template match="cmd0:Components//@ComponentId" >203 <xsl:template match="cmd0:Components//@ComponentId" priority="2"> 185 204 <xsl:attribute name="cmd:ComponentId" select="."/> 186 205 </xsl:template> -
metadata/trunk/toolkit/src/main/resources/toolkit/xsd/cmd-component.xsd
r6904 r6907 80 80 </sch:pattern> 81 81 <!-- TODO: check: the names of referenced external components are not known, so we can't currently check if two or more of them use the same name --> 82 <sch:pattern id="c_nest">83 <sch:title>Check nesting</sch:title>84 <sch:rule context="Component[exists(Component|Element)]" role="warning">85 <sch:assert test="empty((Component|Element)[@name=current()/@name])">A nested component or element has the same name ('<sch:value-of select="@name"/>') as this component! Please, consider to rename one of them.</sch:assert>86 </sch:rule>87 </sch:pattern>88 82 </xs:appinfo> 89 83 </xs:annotation>
Note: See TracChangeset
for help on using the changeset viewer.