W3C home > Mailing lists > Public > www-forms@w3.org > February 2006

absent vs empty attributes

From: Duane Gran <dgran@duanegran.com>
Date: Wed, 1 Feb 2006 09:03:58 -0500
Message-Id: <BD7F9719-85EE-43FA-89CC-88E71856D22A@duanegran.com>
To: www-forms@w3.org

I have a question about attributes which have required values, but  
the attribute itself is optional.  I'm attempting to bind an XForm  
checkbox to an attribute, called keyDate, which is defined in the  
following Schema:

<xsd:attribute name="keyDate" use="optional">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="yes"/>

So the only valid instance document would be one where the keyDate  
attribute is absent, or one where it is present and contains "yes" as  
the value.  My preferred behavior for this would be the production of  
an instance document without the attribute when the box is unchecked,  
but if checked the attribute's value would be set.  Is this  
possible?  Have others come up with solutions for this scenario?

If it helps, below is my XForms control, as it is used in OPS:

                   <xforms:select ref="@keyDate" appearance="full">
                     <xforms:label class="fixed-width  
attribute">keyDate: </xforms:label>

Duane Gran
Received on Wednesday, 1 February 2006 22:56:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:16 UTC