NeTEx-CEN / NeTEx

NeTEx is a CEN Technical Standard for exchanging Public Transport schedules and related data.
http://netex-cen.eu
GNU General Public License v3.0
83 stars 39 forks source link

Mutually exclusive attributes (for version and versionRef) #773

Open skinkie opened 2 months ago

skinkie commented 2 months ago

https://stackoverflow.com/questions/33748490/how-to-define-mutually-exclusive-attributes-in-xsd

skinkie commented 2 months ago

This may work when applied to every unique ref-element, but not at the top level (NeTEx_publication.xsd) hence cannot be disabled. Why? Because the constraint may only be applied on the local element (like the uniqueness of the key in the key-value-list).

diff --git a/xsd/netex_part_1/part1_tacticalPlanning/netex_servicePattern_support.xsd b/xsd/netex_part_1/part1_tacticalPlanning/netex_servicePattern_support.xsd
index d1ef9e63..9a78af18 100644
--- a/xsd/netex_part_1/part1_tacticalPlanning/netex_servicePattern_support.xsd
+++ b/xsd/netex_part_1/part1_tacticalPlanning/netex_servicePattern_support.xsd
@@ -82,6 +82,10 @@ Rail transport, Roads and Road transport
                <xsd:annotation>
                        <xsd:documentation>Reference to a SCHEDULED STOP POINT.</xsd:documentation>
                </xsd:annotation>
+           <xsd:key name="ScheduledStopPointRefVersionRequired">
+               <xsd:selector xpath="."/>
+               <xsd:field xpath="@version|@versionRef"/>
+           </xsd:key>
        </xsd:element>
        <xsd:complexType name="ScheduledStopPointRefStructure">
                <xsd:annotation>
skinkie commented 2 months ago

We would need to discuss we would do it, or can it be done automatically, but I think the above would significantly help the missing element situation.

Aurige commented 2 weeks ago

Keep this discussion opened and try to find proposal for next milestone (2.1)