- Timestamp:
- 01/29/16 17:06:08 (8 years ago)
- Location:
- metadata/trunk/toolkit/src
- Files:
-
- 2 added
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/src/main/resources/toolkit/upgrade/cmd-record-1_1-to-1_2.xsl
r6925 r6930 12 12 <xsl:param name="cmd-uri" select="'http://www.clarin.eu/cmd/1'"/> 13 13 <xsl:param name="cmd-profile" select="()"/> 14 <xsl:param name="cr-uri" select="'..'"/> 15 <xsl:param name="cr-extension-xsd" select="'-1_2.xsd'"/> 16 <xsl:param name="cr-roundtrip-extension-xsd" select="'-1-1-1_2.xsd'"/> 17 <xsl:param name="cr-extension-xml" select="'-1.2.xml'"/> 14 <xsl:param name="cr-uri" select="'https://catalog.clarin.eu/ds/ComponentRegistry/rest/registry'"/> 15 <!--<xsl:param name="cr-extension-xsd" select="'/1.2/xsd'"/>--> 16 <xsl:param name="cr-extension-xsd" select="'/xsd'"/> 17 <xsl:param name="cr-roundtrip-extension-xsd" select="'/1.1/1.2/xsd'"/> 18 <!--<xsl:param name="cr-extension-xml" select="'/1.2/xml'"/>--> 19 <xsl:param name="cr-extension-xml" select="'/xml'"/> 18 20 19 21 <xsl:param name="escape" select="'ccmmddii_'"/> … … 63 65 <xsl:variable name="cr-profile-xml" select="concat($cr-profiles,'/',$profile,$cr-extension-xml)"/> 64 66 <xsl:variable name="cr-profile-xsd"> 65 <xsl:variable name="prof" select="if (exists($cmd-profile)) then ($cmd-profile) else (doc( resolve-uri($cr-profile-xml,base-uri())))"/>67 <xsl:variable name="prof" select="if (exists($cmd-profile)) then ($cmd-profile) else (doc($cr-profile-xml))"/> 66 68 <xsl:choose> 67 69 <!-- '' means there was no @CMDOriginalVersion, so the original version is 1.2 (the default) --> … … 189 191 <!-- don't know if the parent is a component without children, or an element without value 190 192 have a look at the profile --> 191 <xsl:variable name="prof" select="if (exists($cmd-profile)) then ($cmd-profile) else (doc( resolve-uri($cr-profile-xml,base-uri())))"/>193 <xsl:variable name="prof" select="if (exists($cmd-profile)) then ($cmd-profile) else (doc($cr-profile-xml))"/> 192 194 <xsl:variable name="path" select="ancestor::*[. >> /cmd0:CMD/cmd0:Components]"/> 193 195 <xsl:variable name="attr" select="$prof//Attribute[@name='ref' or Name='ref'][string-join(ancestor::*[local-name()=('Component','CMD_Component','Element','CMD_Element')]/@name,'/')=string-join($path/local-name(),'/')]"/> -
metadata/trunk/toolkit/src/main/resources/toolkit/xslt/clavas2enum.xsl
r6922 r6930 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" 3 xmlns:xs="http://www.w3.org/2001/XMLSchema" 4 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 5 xmlns:dc="http://purl.org/dc/elements/1.1/" 6 xmlns:dcterms="http://purl.org/dc/terms/" 7 xmlns:skos="http://www.w3.org/2004/02/skos/core#" 8 xmlns:openskos="http://openskos.org/xmlns#" 9 exclude-result-prefixes="xs rdf dc dcterms skos openskos"> 2 10 3 <!-- 4 $Rev$ 5 $Date$ 6 --> 7 8 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cmd="http://www.clarin.eu/cmd/1" xmlns:cue="http://www.clarin.eu/cmdi/cues/1"> 9 10 <xsl:param name="cmd-toolkit" select="'../../../../../main/resources/toolkit'"/> 11 <xsl:param name="cmd-envelop" select="concat($cmd-toolkit,'/xsd/cmd-envelop.xsd')"/> 12 13 <xsl:variable name="CMDVersion" select="'1.2'"/> 11 <xsl:param name="clavas-uri" select="'https://openskos.meertens.knaw.nl/clavas'"/> 12 <xsl:param name="clavas-limit" select="'10'"/> 13 <xsl:param name="clavas-prop" select="'skos:prefLabel'"/> 14 <xsl:param name="clavas-lang" select="'en'"/> 14 15 15 <xsl:variable name="ns-uri" select="concat('http://www.clarin.eu/cmd/1/profiles/',/ComponentSpec/Header/ID)"/> 16 17 <xsl:strip-space elements="*"/> 18 19 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/> 20 21 <!-- resolve includes --> 22 <xsl:template match="@*|node()" mode="include"> 16 <xsl:template match="Vocabulary[normalize-space(@URI)!='']"> 17 <xsl:variable name="vocab-uri" select="@URI"/> 18 <xsl:variable name="vocab-prop" select="if (normalize-space(@ValueProperty)!='') then (normalize-space(@ValueProperty)) else ($clavas-prop)"/> 19 <xsl:variable name="vocab-lang" select="if (normalize-space(@ValueLanguage)!='') then (normalize-space(@ValueLanguage)) else ($clavas-lang)"/> 23 20 <xsl:copy> 24 <xsl:apply-templates select="@*|node()" mode="include"/> 21 <xsl:copy-of select="@*"/> 22 <enumeration> 23 <xsl:for-each select="doc(concat($clavas-uri,'/api/find-concepts?rows=',$clavas-limit,'&q=inScheme:',replace($vocab-uri,':','\\:')))//rdf:Description[rdf:type/@rdf:resource='http://www.w3.org/2004/02/skos/core#Concept']"> 24 <xsl:variable name="entry"> 25 <xsl:choose> 26 <xsl:when test="normalize-space(*[name()=$vocab-prop][@xml:lang=$vocab-lang][1])!=''"> 27 <xsl:value-of select="normalize-space(*[name()=$vocab-prop][@xml:lang=$vocab-lang][1])"/> 28 </xsl:when> 29 <xsl:when test="normalize-space(*[name()=$vocab-prop][empty(@xml:lang)][1])!=''"> 30 <xsl:value-of select="normalize-space(*[name()=$vocab-prop][empty(@xml:lang)][1])"/> 31 </xsl:when> 32 <xsl:when test="normalize-space(*[name()=$vocab-prop][1])!=''"> 33 <xsl:value-of select="normalize-space(*[name()=$vocab-prop][1])"/> 34 </xsl:when> 35 <xsl:when test="normalize-space(skos:prefLabel[@xml:lang=$vocab-lang][1])!=''"> 36 <xsl:message>WRN: ValueProperty[<xsl:value-of select="$vocab-prop"/>] couldn't be found for entry[<xsl:value-of select="@rdf:about"/>], falling back to skos:prefLabel[<xsl:value-of select="normalize-space(skos:prefLabel[@xml:lang=$vocab-lang][1])"/>]!</xsl:message> 37 <xsl:value-of select="normalize-space(skos:prefLabel[@xml:lang=$vocab-lang][1])"/> 38 </xsl:when> 39 <xsl:when test="normalize-space(skos:prefLabel[empty(@xml:lang)][1])!=''"> 40 <xsl:message>WRN: ValueProperty[<xsl:value-of select="$vocab-prop"/>] couldn't be found for entry[<xsl:value-of select="@rdf:about"/>], falling back to skos:prefLabel[<xsl:value-of select="normalize-space(skos:prefLabel[empty(@xml:lang)][1])"/>]!</xsl:message> 41 <xsl:value-of select="normalize-space(skos:prefLabel[empty(@xml:lang)][1])"/> 42 </xsl:when> 43 <xsl:when test="normalize-space(skos:prefLabel[1])!=''"> 44 <xsl:message>WRN: ValueProperty[<xsl:value-of select="$vocab-prop"/>] couldn't be found for entry[<xsl:value-of select="@rdf:about"/>], falling back to skos:prefLabel[<xsl:value-of select="normalize-space(skos:prefLabel[1])"/>]!</xsl:message> 45 <xsl:value-of select="normalize-space(skos:prefLabel[1])"/> 46 </xsl:when> 47 </xsl:choose> 48 </xsl:variable> 49 <xsl:choose> 50 <xsl:when test="normalize-space($entry)!=''"> 51 <item ConceptLink="{@rdf:about}"> 52 <xsl:choose> 53 <xsl:when test="normalize-space(skos:prefLabel[@xml:lang=$vocab-lang][1])!=''"> 54 <xsl:attribute name="AppInfo" select="normalize-space(skos:prefLabel[@xml:lang=$vocab-lang][1])"/> 55 </xsl:when> 56 <xsl:when test="normalize-space(skos:prefLabel[empty(@xml:lang)][1])!=''"> 57 <xsl:attribute name="AppInfo" select="normalize-space(skos:prefLabel[empty(@xml:lang)][1])"/> 58 </xsl:when> 59 <xsl:when test="normalize-space(skos:prefLabel[1])!=''"> 60 <xsl:attribute name="AppInfo" select="normalize-space(skos:prefLabel[1])"/> 61 </xsl:when> 62 </xsl:choose> 63 <xsl:value-of select="$entry"/> 64 </item> 65 </xsl:when> 66 <xsl:otherwise> 67 <xsl:message>ERR: non empty instance of ValueProperty[<xsl:value-of select="$vocab-prop"/>] couldn't be found for entry[<xsl:value-of select="@rdf:about"/>] and no skos:prefLabel found, skipping it!</xsl:message> 68 </xsl:otherwise> 69 </xsl:choose> 70 </xsl:for-each> 71 </enumeration> 25 72 </xsl:copy> 26 73 </xsl:template> 27 74 28 <xsl:template match="Component[@filename]" mode="include">29 <!-- some of the outer CMD_Component attributes can overwrite the inner Component attributes -->30 <xsl:variable name="outer-attr" select="@CardinalityMin|@CardinalityMax"/>31 <xsl:for-each select="document(@filename)/ComponentSpec/Component">32 <xsl:variable name="inner-attr" select="@*"/>33 <xsl:copy>34 <xsl:apply-templates select="$outer-attr" mode="include"/>35 <xsl:apply-templates select="$inner-attr[not(node-name(.) = $outer-attr/node-name(.))]" mode="include"/>36 <xsl:apply-templates select="node()" mode="include"/>37 </xsl:copy>38 </xsl:for-each>39 </xsl:template>40 41 <!-- main -->42 <xsl:template match="/">43 <!-- Resolve all includes -->44 <xsl:variable name="tree">45 <xsl:apply-templates mode="include"/>46 </xsl:variable>47 <!-- Process the complete tree -->48 <xsl:apply-templates select="$tree/*"/>49 </xsl:template>50 51 <!-- generate XSD -->52 <xsl:template match="/ComponentSpec">53 54 <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="{$ns-uri}" elementFormDefault="qualified">55 56 <xsl:namespace name="cmdp" select="$ns-uri"/>57 58 <!-- put the header information from the component specification in the schema as appinfo -->59 <xs:annotation>60 <xs:appinfo xmlns:ann="http://www.clarin.eu">61 <xsl:apply-templates select="Header" mode="Header"/>62 </xs:appinfo>63 </xs:annotation>64 65 <!-- import xml.xsd for the use of the xml:lang attribute -->66 <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>67 68 <!-- import cmd-envelop for the use of the general CMD attributes -->69 <xs:import namespace="http://www.clarin.eu/cmd/1" schemaLocation="{$cmd-envelop}"/>70 71 72 <!-- first create complex types for valueschemes (not inline) -->73 <xsl:call-template name="CreateComplexTypes"/>74 75 <!--Start with processing the root component once and then process everything else recursively-->76 <xsl:apply-templates select="Component"/>77 78 </xs:schema>79 80 </xsl:template>81 82 <xsl:template match="*" mode="Header">83 <xsl:element name="cmd:{name()}">84 <xsl:value-of select="text()"/>85 <xsl:apply-templates select="*" mode="Header"/>86 </xsl:element>87 </xsl:template>88 89 <xsl:template name="CreateComplexTypes">90 <xsl:apply-templates select="Component" mode="types"/>91 </xsl:template>92 93 <!-- create a unique identifier from the current element -->94 <xsl:function name="cmd:getComponentId">95 <xsl:param name="node"/>96 97 <xsl:text>-</xsl:text>98 99 <xsl:choose>100 101 <!-- deeper recursion needed -->102 <xsl:when test="$node[empty(@ComponentId)]">103 104 <xsl:choose>105 <!-- element has name, add it to the type name and recurse upwards in the tree -->106 <xsl:when test="$node/self::Element">107 <xsl:value-of select="$node/@name"/>108 </xsl:when>109 <!-- "worst" case: embedded anonymous component without ComponentId: use the xpath -->110 <xsl:when test="$node/self::Component">111 <xsl:value-of select="count($node/preceding-sibling::*)"/>112 </xsl:when>113 </xsl:choose>114 115 <!-- recursive call -->116 <xsl:value-of select="cmd:getComponentId($node/..)"/>117 118 </xsl:when>119 120 <!-- end of recursion: component has ComponentId -->121 <xsl:otherwise>122 <xsl:value-of select="replace($node/@ComponentId, ':', '.')"/>123 </xsl:otherwise>124 125 </xsl:choose>126 127 </xsl:function>128 129 <!-- generate types -->130 131 <!-- skip all text nodes -->132 <xsl:template match="text()" mode="types"/>133 134 <!-- first pass: create the complex types on top of the resulting XSD -->135 <xsl:template match="Element/ValueScheme[exists(Vocabulary/enumeration)]" mode="types">136 137 <!-- only handle the ValueScheme if this is the first occurence of the Component -->138 <xsl:variable name="Component" select="ancestor::Component[exists(@ComponentId)]"/>139 <xsl:if test="empty($Component/preceding::Component[@ComponentId=$Component/@ComponentId])">140 141 <!-- create a unique suffix (the path to the element) to ensure the unicity of the types to be created -->142 <xsl:variable name="uniquePath" select="cmd:getComponentId(..)"/>143 144 <!-- first auto-generate a name for the simpletype to be extended -->145 <xs:simpleType name="simpletype{$uniquePath}">146 <xs:restriction base="xs:string">147 <xsl:apply-templates select="pattern"/>148 <xsl:apply-templates select="Vocabulary/enumeration"/>149 </xs:restriction>150 </xs:simpleType>151 152 <!-- then auto-derive a complextype for the attributes -->153 <xs:complexType name="complextype{$uniquePath}">154 <xs:simpleContent>155 <xs:extension base="cmdp:simpletype{$uniquePath}">156 <!-- now look at the attribute list of the Element parent of this ValueScheme-->157 <xsl:apply-templates select="parent::Element/AttributeList/Attribute"/>158 <!-- an element can refer to an entry in a closed external vocabulary -->159 <xsl:if test="parent::Element/ValueScheme/Vocabulary/@URI">160 <xs:attribute ref="cmd:ValueConceptLink"/>161 </xsl:if>162 </xs:extension>163 </xs:simpleContent>164 </xs:complexType>165 </xsl:if>166 167 </xsl:template>168 169 <!-- Stop types -->170 171 <!-- convert all components -->172 <xsl:template match="Component">173 174 <xs:element name="{@name}">175 176 <xsl:call-template name="annotations"/>177 178 <xsl:apply-templates select="@ConceptLink"/>179 <xsl:apply-templates select="@CardinalityMin"/>180 <xsl:apply-templates select="@CardinalityMax"/>181 182 <xs:annotation>183 <xsl:apply-templates select="Documentation"/>184 </xs:annotation>185 186 <xs:complexType>187 188 <xs:sequence>189 <!-- process all elements at this level -->190 <xsl:apply-templates select="./Element"/>191 <!-- process all components at one level deeper (recursive call) -->192 <xsl:apply-templates select="./Component"/>193 </xs:sequence>194 195 <!-- allow @xml:base as a residue of XInclude processing -->196 <xs:attribute ref="xml:base"/>197 198 <!-- @ref to the resource proxy -->199 <xs:attribute ref="cmd:ref"/>200 201 <!-- allow @ComponentId referring to this Component -->202 <xsl:if test="exists(@ComponentId)">203 <xs:attribute ref="cmd:ComponentId" fixed="{@ComponentId}"/>204 </xsl:if>205 206 <xsl:apply-templates select="./AttributeList/Attribute"/>207 208 </xs:complexType>209 210 </xs:element>211 212 </xsl:template>213 214 <!-- Process all Elements, its attributes and children -->215 216 <!-- Highest complexity: both attributes and a ValueScheme, link to the type we created during the preprocessing of the ValueScheme -->217 <xsl:template match="Element[./AttributeList][./ValueScheme[exists(enumeration)]]" priority="3">218 <xs:element name="{@name}">219 220 <xsl:apply-templates select="@ConceptLink"/>221 <xsl:apply-templates select="@CardinalityMin"/>222 <xsl:apply-templates select="@CardinalityMax"/>223 <xsl:apply-templates select="ValueScheme"/>224 225 <!-- process all autovalue and cues attributes -->226 <xsl:call-template name="annotations"/>227 228 <xs:annotation>229 <xsl:apply-templates select="Documentation"/>230 </xs:annotation>231 232 </xs:element>233 </xsl:template>234 235 <!-- Medium complexity: attributes (or Multilingual field) but no valuescheme, can be arranged inline -->236 <xsl:template match="Element[./AttributeList or ./@Multilingual='true']" priority="2">237 <xs:element name="{@name}">238 239 <xsl:apply-templates select="@Multilingual"/>240 <xsl:apply-templates select="@ConceptLink"/>241 <xsl:apply-templates select="@CardinalityMin"/>242 <xsl:apply-templates select="@CardinalityMax"/>243 244 <!-- process all autovalue and cues attributes -->245 <xsl:call-template name="annotations"/>246 247 <xs:annotation>248 <xsl:apply-templates select="Documentation"/>249 </xs:annotation>250 251 <xs:complexType>252 <xs:simpleContent>253 <xs:extension base="{concat('xs:',@ValueScheme)}">254 <xsl:apply-templates select="./AttributeList/Attribute"/>255 <xsl:if test="./@Multilingual='true'">256 <xs:attribute ref="xml:lang"/>257 </xsl:if>258 <!-- an element can refer to an entry in an open external vocabulary -->259 <xsl:if test="exists(./ValueScheme/@URI)">260 <xs:attribute ref="cmd:ValueConceptLink"/>261 </xsl:if>262 </xs:extension>263 </xs:simpleContent>264 </xs:complexType>265 </xs:element>266 </xsl:template>267 268 <!-- Simple case: no attributes and no value scheme, 1-to-1 transform to an xs:element, just rename element and attributes -->269 <xsl:template match="Element" priority="1">270 <xsl:element name="xs:element">271 272 <xsl:apply-templates select="@name"/>273 <xsl:apply-templates select="@Multilingual"/>274 <xsl:apply-templates select="@ConceptLink"/>275 <xsl:apply-templates select="@CardinalityMin"/>276 <xsl:apply-templates select="@CardinalityMax"/>277 <xsl:apply-templates select="@ValueScheme"/>278 279 <!-- process all autovalue and cues attributes -->280 <xsl:call-template name="annotations"/>281 <xs:annotation>282 <xsl:apply-templates select="Documentation"/>283 </xs:annotation>284 285 </xsl:element>286 </xsl:template>287 288 <!-- end of Element templates -->289 290 <!-- second pass, now link to the earlier created ComplexType definition -->291 <xsl:template match="ValueScheme">292 <xsl:variable name="uniquePath" select="cmd:getComponentId(..)"/>293 <xsl:attribute name="type">294 <xsl:text>cmdp:complextype</xsl:text>295 <xsl:value-of select="$uniquePath"/>296 </xsl:attribute>297 </xsl:template>298 299 <!-- Convert the AttributeList into real XSD attributes -->300 <xsl:template match="AttributeList/Attribute">301 <xs:attribute name="{@name}">302 303 <!-- a mandatory attribute? -->304 <xsl:if test="@Required='true'">305 <xsl:attribute name="use" select="'required'"/>306 </xsl:if>307 308 <!-- Add a cmd:ConceptLink if a ConceptLink element is found -->309 <xsl:if test="normalize-space(@ConceptLink)!=''">310 <xsl:attribute name="cmd:ConceptLink">311 <xsl:value-of select="@ConceptLink"/>312 </xsl:attribute>313 </xsl:if>314 315 <!-- add some extra stuff if we have a CV attribute -->316 <xsl:choose>317 318 <!-- complex situation: CV or regex -->319 <xsl:when test="exists(./ValueScheme/((Vocabulary/enumeration)|pattern))">320 321 <xs:annotation>322 <xsl:apply-templates select="Documentation"/>323 </xs:annotation>324 325 <xs:simpleType>326 <xs:restriction base="xs:string">327 <!-- now use general rules for enumeration or pattern -->328 <xsl:apply-templates select="./ValueScheme/*"/>329 </xs:restriction>330 </xs:simpleType>331 </xsl:when>332 333 <!-- simple situation: just a basic type -->334 <xsl:otherwise>335 <xsl:attribute name="type">336 <xsl:value-of select="concat('xs:',@ValueScheme)"/>337 </xsl:attribute>338 339 <xs:annotation>340 <xsl:apply-templates select="Documentation"/>341 </xs:annotation>342 343 </xsl:otherwise>344 345 </xsl:choose>346 347 </xs:attribute>348 </xsl:template>349 350 <!-- Convert patterns -->351 <xsl:template match="pattern">352 <xs:pattern value="{self::node()}"/>353 </xsl:template>354 355 <!-- Convert enumerations -->356 <xsl:template match="Vocabulary">357 <xsl:apply-templates select="@*|node()"/>358 </xsl:template>359 360 <xsl:template match="enumeration">361 <xsl:for-each select="item">362 <xs:enumeration value="{node()}">363 <xsl:apply-templates select="./@ConceptLink"/>364 <xsl:apply-templates select="./@AppInfo"/>365 </xs:enumeration>366 </xsl:for-each>367 </xsl:template>368 369 <!-- default action: keep the attributes like they are -->370 <xsl:template match="@*|node()">371 <xsl:copy/>372 </xsl:template>373 374 <!-- except for those attributes we want to be renamed -->375 <xsl:template match="@CardinalityMin">376 <xsl:attribute name="minOccurs">377 <xsl:value-of select="."/>378 </xsl:attribute>379 </xsl:template>380 381 <xsl:template match="@CardinalityMax">382 <xsl:attribute name="maxOccurs">383 <xsl:value-of select="."/>384 </xsl:attribute>385 </xsl:template>386 387 <!-- the root component can't have cardinality constraints -->388 <xsl:template match="ComponentSpec/Component/@CardinalityMin" priority="1"/>389 390 <xsl:template match="ComponentSpec/Component/@CardinalityMax"/>391 392 <!-- start multilinguality part -->393 394 <!-- if the multilingual attribute is there and the field has the type string, allow multiple occurrences -->395 <xsl:template match="@Multilingual[../@ValueScheme='string'][. = 'true'] ">396 <xsl:attribute name="maxOccurs">397 <xsl:value-of>unbounded</xsl:value-of>398 </xsl:attribute>399 </xsl:template>400 401 <xsl:template match="@Multilingual">402 <!-- do nothing - only influences maxOccurs if it is true and if it is a a string element -->403 </xsl:template>404 405 <xsl:template match="@CardinalityMax[../@Multilingual='true'][../@ValueScheme='string']">406 <!-- do nothing - maxOccurs should be set by Multilingual rule for strings -->407 </xsl:template>408 409 <!-- end multilinguality part -->410 411 <!-- Add a @cmd:ConceptLink if a ConceptLink attribute is found -->412 <xsl:template match="@ConceptLink">413 <xsl:attribute name="cmd:ConceptLink">414 <xsl:value-of select="."/>415 </xsl:attribute>416 </xsl:template>417 418 <xsl:template match="@AppInfo">419 <xsl:attribute name="cmd:label">420 <xsl:value-of select="."/>421 </xsl:attribute>422 </xsl:template>423 424 <xsl:template match="@ValueScheme">425 <xsl:attribute name="type">426 <xsl:value-of select="concat('xs:',.)"/>427 </xsl:attribute>428 </xsl:template>429 430 <xsl:template match="Vocabulary/@URI">431 <xsl:attribute name="cmd:Vocabulary">432 <xsl:value-of select="."/>433 </xsl:attribute>434 </xsl:template>435 436 <xsl:template match="@ValueProperty|@ValueLanguage">437 <xsl:attribute name="cmd:{local-name()}">438 <xsl:value-of select="."/>439 </xsl:attribute>440 </xsl:template>441 442 <xsl:template match="Documentation">443 <xs:documentation>444 <xsl:copy-of select="@xml:lang"/>445 <xsl:value-of select="."/>446 </xs:documentation>447 </xsl:template>448 449 <xsl:template match="@AutoValue">450 <xsl:attribute name="cmd:AutoValue">451 <xsl:value-of select="."/>452 </xsl:attribute>453 </xsl:template>454 455 <xsl:template match="@cue:*">456 <xsl:copy-of select="."/>457 </xsl:template>458 459 <xsl:template name="annotations">460 <xsl:apply-templates select="@AutoValue"/>461 <xsl:apply-templates select="@cue:*"/>462 </xsl:template>463 464 75 </xsl:stylesheet> -
metadata/trunk/toolkit/src/test/java/eu/clarin/cmd/toolkit/TestCMDToolkit.java
r6929 r6930 150 150 Map<String,XdmValue> params = new HashMap<String,XdmValue>(); 151 151 params.put("cmd-profile", prof); 152 params.put("cr-uri", new XdmAtomicValue("..")); 153 params.put("cr-extension-xsd", new XdmAtomicValue("-1_2.xsd")); 154 params.put("cr-roundtrip-extension-xsd", new XdmAtomicValue("-1-1-1_2.xsd")); 155 params.put("cr-extension-xml", new XdmAtomicValue("-1.2.xml")); 152 156 return transform(upgradeCMDRec,new javax.xml.transform.stream.StreamSource(new java.io.File(TestCMDToolkit.class.getResource(rec).toURI())),params); 153 157 }
Note: See TracChangeset
for help on using the changeset viewer.