Changeset 6833


Ignore:
Timestamp:
11/23/15 06:37:21 (8 years ago)
Author:
Menzo Windhouwer
Message:

M toolkit/src/main/resources/toolkit/xslt/comp2schema.xsl

  • fixed generation of the XSD enumeration
  • propagate Attribute/@Required to xs:attribute/@use
File:
1 edited

Legend:

Unmodified
Added
Removed
  • metadata/trunk/toolkit/src/main/resources/toolkit/xslt/comp2schema.xsl

    r6751 r6833  
    135135    <xsl:template match="Element/ValueScheme[exists(Vocabulary/enumeration)]" mode="types">
    136136       
     137        <xsl:message>DBG: create complex types</xsl:message>
     138       
    137139        <!-- only handle the ValueScheme if this is the first occurence of the Component -->
    138140        <xsl:variable name="Component" select="ancestor::Component[exists(@ComponentId)]"/>
    139141        <xsl:if test="empty($Component/preceding::Component[@ComponentId=$Component/@ComponentId])">
    140 
     142            <xsl:message>DBG: first occurence</xsl:message>
     143           
    141144            <!-- create a unique suffix (the path to the element) to ensure the unicity of the types to be created -->
    142145            <xsl:variable name="uniquePath" select="cmd:getComponentId(..)"/>
     
    146149                <xs:restriction base="xs:string">
    147150                    <xsl:apply-templates select="pattern"/>
    148                     <xsl:apply-templates select="enumeration"/>
     151                    <xsl:apply-templates select="Vocabulary/enumeration"/>
    149152                </xs:restriction>
    150153            </xs:simpleType>
     
    300303    <xsl:template match="AttributeList/Attribute">
    301304        <xs:attribute name="{@name}">
     305           
     306            <!-- a mandatory attribute? -->
     307            <xsl:if test="@Required='true'">
     308                <xsl:attribute name="use" select="'required'"/>
     309            </xsl:if>
    302310
    303311            <!-- Add a cmd:ConceptLink if a ConceptLink element is found -->
     
    312320
    313321                <!-- complex situation: CV or regex -->
    314                 <xsl:when test="exists(./ValueScheme/(Vocabulary/enumeration|pattern))">
     322                <xsl:when test="exists(./ValueScheme/((Vocabulary/enumeration)|pattern))">
    315323
    316324                    <xs:annotation>
Note: See TracChangeset for help on using the changeset viewer.