Centrally changing context

From W3C Wiki

Centrally changing context (or: the 'size' example) (a co-constraint use case)

source: FV (as per ACTION 2006-03-17.03)

   Individual items within and invoice selling garments has different values allowed depending on whether measurements were expressed in Italian or American units. For instance, size is XS, S, M, L, XL in US, and 40, 42, 44, 46, 48 in Italy (and no: they don't match pairwise, they are different values altogether). The natioality of the unit is expressed in the header part of the invoice, and it controls also other things, such as the form of the customer's address and the monetary unit used for prices. 


   <invoice>
        <header>
            <date>... </date>
            <units size="US" value="US" address="US"/>
            ...
            <customer>
                <name>ACME Inc.</name>
                <address>103 Prince St.</address>
                <city>New York</city>
                <state>NY</state>
                <zip>10012</zip>
            </customer>
        </header>
        <lines>
            <item id="123">
               <description>abc</description>
               <quantity>1200</quantity>
               <size>XS</size>
               <price>34.95</price>
            </item>
            <item id="456">
               <description>def</description>
               <quantity>1000</quantity>
               <size>M</size>
               <price>29.95</price>
            </item>
        </lines>
    </invoice>

   <invoice>
        <header>
            <date>... </date>
            <units size="IT" value="IT" address="IT"/>
            ...
            <customer>
                <name>Ditta Rossi SpA</name>
                <address>Via Garibaldi 12</address>
                <zip>20121</zip>
                <city>Roma</city>
                <province>RM</province>
            </customer>
        </header>
        <lines>
            <item id="123">
               <description>abc</description>
               <quantity>1200</quantity>
               <size>42</size>
               <price>29.95</price>
            </item>
            <item id="456">
               <description>def</description>
               <quantity>1000</quantity>
               <size>46</size>
               <price>23.95</price>
            </item>
        </lines>
    </invoice>