- From: Stanley Guan <stanley.guan@oracle.com>
- Date: Thu, 28 Mar 2002 17:21:37 -0800
- To: xmlschema-dev@w3.org
Jeni, Is the following a valid attribute declaration? <xs:attribute name="domain" type="xs:positiveInteger" use="prohibited" fixed="123"/> If not, where does it state that in the spec.? Thx, -Stanley > Re: Attribute Fixed and Prohibited > > From: Jeni Tennison (jeni@jenitennison.com) > Date: Wed, Mar 27 2002 > > *Next message: Andy Del Rio: "RE: ID & IDREF Schema Confusion" > > * Previous message: Jeni Tennison: "Re: Invalid particle derivation by restriction (XMLSpy vs. MSXML4)" > * In reply to: Joey: "Attribute Fixed and Prohibited" > * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] > * Other mail archives: [this mailing list] [other W3C mailing lists] > * Mail actions: [ respond to this message ] [ mail a new topic ] > > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Date: Wed, 27 Mar 2002 13:23:48 +0000 > From: Jeni Tennison <jeni@jenitennison.com> > Message-ID: <130400635723.20020327132348@jenitennison.com> > To: Joey <lpjcoyle@ihc.com> > CC: xmlschema-dev@w3.org > Subject: Re: Attribute Fixed and Prohibited > > Hi Joey, > > > I want an attribute to have a fixed value that is available to the > > schema processor, but not allow the attribute in instances. Is the > > following valid, and does it do what I want. > > > > <xs:attribute name="domain" type="xs:positiveInteger" use="prohibited" > > fixed="123"/> > > The use="prohibited" attribute is a way of removing attribute uses > from the set of attributes for a complex type when you derive by > restriction. It bans the attribute from appearing in the instance, but > it also means that the attribute isn't present in the PSVI, so you > won't have access to the fixed value at all. > > I don't think that there is a way of doing what you describe. I guess > that you could say that the attribute is optional (the default), with > a fixed value: > > <xs:attribute name="domain" type="xs:positiveInteger" fixed="123"/> > > And then have a Schematron rule that tests whether it's actually > present: > > <sch:report test="@domain"> > The domain attribute should not be present. > </sch:report> > > This will only work if you're using Schematron with XSLT 1.0; come > XSLT 2.0, XSLT will work over the PSVI, so won't be able to tell the > difference between an attribute that's actually present in the > document and one that's been fixed or defaulted in the schema. > > Out of interest, why do you want to do this, and how are you intending > that the fixed attribute be used by applications? If you want to > provide a kind of "annotation" about an element, I suggest that you > use xs:appinfo instead: > > <xs:appinfo> > <my:domain>123</my:domain> > </xs:appinfo> > > Applications with access to the PSVI should get access to the content > of xs:appinfo in order to get this value; since it's not declared as > an attribute, there's no risk of it appearing in the instance > document. > > Cheers, > > Jeni > > --- > Jeni Tennison > http://www.jenitennison.com/ > > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > * Next message: Andy Del Rio: "RE: ID & IDREF Schema Confusion" > * Previous message: Jeni Tennison: "Re: Invalid particle derivation by restriction (XMLSpy vs. MSXML4)" > * In reply to: Joey: "Attribute Fixed and Prohibited" > * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] > * Other mail archives: [this mailing list] [other W3C mailing lists] > * Mail actions: [ respond to this message ] [ mail a new topic ]
Received on Thursday, 28 March 2002 20:21:40 UTC