I have a xsd schema with embedded schematron rules as below. It does does not work. Appreciate any ideas. The XML snippet is given below.
Thanks
TechHead
<!--- Schematron Rules -->
<!-- QandA Type -->
<xs:complexType name="qAndAType">
<xs:sequence>
<xs:element name="Question" type="questionType" minOccurs="1">
<xs:annotation>
<xs:appinfo>
<sch:pattern id="answerTests" name="AnswerValueType">
<sch:rule context="sr:AnswerValueType[text()='Count']">
<sch:assert diagnostics="d1" test="count(../sr:QandA/Answer/CountValue) = 1">
If AnswerValueType = Count, there should be a CountValue in Answer
</sch:assert>
</sch:rule>
<sch:rule context="sr:AnswerValueType[text()='Bool']">
<sch:assert diagnostics="d1" test="count(../sr:Answer/BoolValue) = 1">
If AnswerValueType = Bool, there should be a BoolValue in Answer
</sch:assert>
</sch:rule>
</sch:pattern>
<sch:diagnostics>
<sch:diagnostic id="d1"> Value of count = <sch:value-of select="test"/> </sch:diagnostic>
</sch:diagnostics>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Answer" type="answerType" minOccurs="1" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
</xs:complexType>
XML is as below showing only relevant tags.
<QandA>
<Question>
<QuestionNumber>A1</Question>
<AnswerValueType>Bool</AnwwerValueType>
</Question>
<Answer>
<BoolValue>true</BoolValue>
</Answer>
</QandA>





data server software 