Hi Andre,
Just as the derived types added the @type attribute they can add any number
of attributes - e.g. @phase:
[...]
<xs:complexType name="res-thing">
<xs:complexContent>
<xs:extension base="res-base">
<xs:attribute name="type" type="thing-type"/>
<xs:attribute name="phase" type="thing-phase"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="res-being">
<xs:complexContent>
<xs:extension base="res-base">
<xs:attribute name="type" type="being-type"/>
<xs:attribute name="phase" type="being-phase"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
[...]
<xs:simpleType name="being-phase">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="being-phase-1"/>
<xs:enumeration value="being-phase-2"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="thing-phase">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="thing-phase-1"/>
<xs:enumeration value="thing-phase-2"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
BTW: I never considered my approach to be anything special. It's simply I
understood the alternate types are meant to be used...
Regards,
Patrik
------------------------------------------------------------------
Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail: mailto:Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de
-----Ursprüngliche Nachricht-----
Von: Andre Cusson akhu01(_at_)gmail(_dot_)com [mailto:xsl-list-
service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Gesendet: Freitag, 11. August 2017 04:22
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: [xsl] alternate attribute types in xsd
Dear Dr Stellmann,
While it seems unfortunate that XSD (e.g. 1.1) does not support conditional
attribute types, some subscribers to this list have suggested interesting
workarounds.
The RELAX NG approach suggested by Syd Bauman, seems especially elegant,
expressive, and powerful.
Unfortunately, the availability of common high performance RELAX NG
validators
seems like an issue for this application.
While seemingly somewhat deliciously devious, your XSD approach is certainly
very interesting.
I would be just about to use it but there seems to be one more consideration
that
was unfortunately not obvious from the simplified example I provided.
I would like to it submit to you, and others possibly, in the hope that you
could
further help resolve it.
The issue is that the res element in the model I am trying to put together
has more
attributes, including 4 more, currently, for which, like the @type attribute
in the
example, the attribute type also depends on the value of the @class
attribute.
Luckily, for now still, I do not need cascading conditional types, as all
five of
these attributes depend on the value of the same @class attribute.
In other words, there are attributes like @status, @phase, @mode, @group, for
example, which are enumerations also, just like for the @type attribute, and
that
each depend on the value of the @class attribute.
For example, for the @phase attribute, there could be a thing-phase-type as
well
as a being-phase-type, whether @class="thing"
or @class="being", and so on.
I can imagine that I could possibly define square(# of
conditional-attributes, e.g.
25) extension types and try to figure out some way to assign them some, but
it
seems less obvious than I would hope.
Is there a way to express this type of conceptually conditional attributes
in XSD?
If so, how would you handle having just one more @class dependent attribute
type
(e.g. @phase)?
Thank you for your support, your time, and for an interesting and creative
example
use of XSD.
Regards,
ac
GDV Dienstleistungs-GmbH
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de
Sitz und Registergericht: Hamburg
HRB 145291
USt.-IdNr : DE 205183123
Geschäftsführer:
Dr. Jens Bartenwerfer
Michael Bathke
Fred di Giuseppe Chiachiarella
Thomas Fischer
Aufsichtsratsvorsitzender: Werner Schmidt
------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe der E-Mail ist nicht gestattet.
This e-mail and any attached files may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.