I'm having a problem with the attached schema.
In the discriminators (lines 44 & 51), I cannot get Daffodil to access the 
value of Type (line 34).
When I tried ../Type, it says valid options are P_INT32 & P_UINT32, I figured I 
needed to go back another level, but ../../Type doesn't work either. At this 
point it says valid options are Msg_ID & Parameter, which are too far back!
However, line 37 has no problem accessing Length (line35).
Anyone have an explanation for this? ...or even better, a solution?

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
           xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";
           xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
           xmlns:fn="http://www.w3.org/2005/xpath-functions";>
           
    <xs:annotation>
        <xs:appinfo source="http://www.ogf.org/dfdl/";>
            <dfdl:format alignmentUnits="bits" lengthUnits="bits" representation="binary" binaryNumberRep="binary"
            	         byteOrder="bigEndian" bitOrder="mostSignificantBitFirst" choiceLengthKind="implicit" lengthKind="implicit" alignment="1" encodingErrorPolicy="replace" 
                         binaryFloatRep="ieee" calendarPatternKind="implicit" documentFinalTerminatorCanBeMissing="yes" 
                         emptyValueDelimiterPolicy="none" escapeSchemeRef="" fillByte="f" floating="no" ignoreCase="no" 
                         initiatedContent="no" initiator="" leadingSkip="0" separator="" separatorPolicy="suppressed" 
                         outputNewLine="%CR;%LF;"
                         textStandardZeroRep="0" textStandardInfinityRep="Inf" textStandardExponentRep="E" 
                         textStandardNaNRep="NaN" textNumberPattern="#,##0.###;-#,##0.###" textNumberRounding="explicit" 
                         textNumberRoundingMode="roundUnnecessary" textNumberRoundingIncrement="0" textStandardGroupingSeparator="," 
                         separatorPosition="infix" sequenceKind="ordered" terminator="" textBidi="no" textNumberCheckPolicy="strict" 
                         textNumberRep="standard" textOutputMinLength="0" textPadKind="none" textStandardBase="10" textTrimKind="none" trailingSkip="0" truncateSpecifiedLengthString="no" 
                         utf16Width="fixed" encoding="US-ASCII" nilKind="literalValue" nilValueDelimiterPolicy="none" occursCountKind="parsed"
						 binaryBooleanTrueRep="1" binaryBooleanFalseRep="0"
                         />
        </xs:appinfo>
    </xs:annotation>


	<xs:element name="Var_Params" >
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Msg_ID" type="unsignedint16" />
                <xs:element name="Parameter" maxOccurs="unbounded" minOccurs="1" >
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Type" type="unsignedint4" />
                            <xs:element name="Length" type="unsignedint8" />
                            <xs:element name="Tag_ID" type="xs:int" dfdl:lengthUnits="bits" dfdl:lengthKind="explicit" dfdl:length="20" />
                            <xs:element name="Values" dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes" dfdl:length="{../Length}" >
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:choice>
                                            <xs:element name="P_INT32" type="signedint32" maxOccurs="unbounded" dfdl:occursCountKind="implicit" >
                                                <xs:annotation>
                                                    <xs:appinfo source="http://www.ogf.org/dfdl/";>
                                                        <dfdl:discriminator test="{ ../Type eq 1 }" />
                                                    </xs:appinfo>
                                                </xs:annotation>
                                            </xs:element>
                                            <xs:element name="P_UINT32" type="unsignedint32" maxOccurs="unbounded" dfdl:occursCountKind="implicit" >
                                                <xs:annotation>
                                                    <xs:appinfo source="http://www.ogf.org/dfdl/";>
                                                        <dfdl:discriminator test="{ ../Type eq 2 }" />
                                                    </xs:appinfo>
                                                </xs:annotation>
                                            </xs:element>
                                        </xs:choice>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:simpleType name="boolean" dfdl:length="1" dfdl:lengthKind="explicit">
		<xs:restriction base="xs:unsignedInt"/>
	</xs:simpleType>

	<xs:simpleType name="unsignedint4" dfdl:length="4" dfdl:lengthKind="explicit">
		<xs:restriction base="xs:unsignedInt"/>
	</xs:simpleType>

	<xs:simpleType name="unsignedint8" dfdl:length="8" dfdl:lengthKind="explicit">
		<xs:restriction base="xs:unsignedInt"/>
	</xs:simpleType>
    
	<xs:simpleType name="unsignedint16" dfdl:length="16" dfdl:lengthKind="explicit">
		<xs:restriction base="xs:unsignedInt"/>
	</xs:simpleType>
    
    <xs:simpleType name="hexBin16" dfdl:length="16" dfdl:lengthKind="explicit">
        <xs:restriction base="xs:hexBinary"/>
    </xs:simpleType>

    <xs:simpleType name="hexBin32" dfdl:length="32" dfdl:lengthKind="explicit">
        <xs:restriction base="xs:hexBinary"/>
    </xs:simpleType>

    <xs:simpleType name="hexBin64" dfdl:length="64" dfdl:lengthKind="explicit">
        <xs:restriction base="xs:hexBinary"/>
    </xs:simpleType>

	<xs:simpleType name="signedint32" dfdl:length="32" dfdl:lengthKind="explicit">
		<xs:restriction base="xs:int"/>
	</xs:simpleType>

	<xs:simpleType name="unsignedint32" dfdl:length="32" dfdl:lengthKind="explicit">
		<xs:restriction base="xs:unsignedInt"/>
	</xs:simpleType>

</xs:schema>

Reply via email to