Schematron

BTT Validation Tool leverages schematron to validate BTT element reference, that is whether the defined BTT element is unique or not. BTT Validation Tool integrates schematron and provides a framework to interprete schematron validation result, so that the schematron validation result can be reported to Web Tools Platform (WTP) validation framework without any coding.

By this framework, you can plug your own schematron validation rule to BTT Validation Tool easily. What you need to do is to add your own rule in schematron format. The user-defined rule can be interpreted by the BTT Validation Tool, and the errors will be detected and reported to the WTP validation framework.

Following is the standard schmatron validation rule for dsectxt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">
    <sch:patter name="Validate Key Collection Reference.">
        <sch:assert test="document('dsedata.xml')/child::*/kColl[@id=current()/@refId ]">
                The refKCol doesn't exist .ATTRIBUTErefIdATTRIBUTE
        </sch:assert>
    </sch:rule>
    <sch:rule context="context">
        <sch:assert test="not(@parent) or //context[@id=current90/@parent]">
                The parent context doesn't exist.ATTRIBUTEparentATTRIBUTE
        </sch:assert>
    </sch:rule>

    <sch:rule context=//*">
        <sch:assert test="not(@id) or name(preceding-sibling::*[@id=current()/@id])!=name()">
                    Duplicated id.ATTRIBUTEidATTRIBUTE
        </sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>
The schematron rules can validate:
  • Whether the <refKColl> refers to existing kColl element in dsedata.xml file
  • Whether the parent attribute of the <context> element refers to existing <context> element in dsectxt.xml file.
  • Whether all the elements in the dsectxt.xml file are unique within their namespace.
If you want to extend BTT validation tool, you can add your own rule to the related schematron rule file. For example, if you want to validate if there is a context named test_context, you can add your own rule as follows:
<sch:rule context="context">
    <sch:assert test="not(@id) or current()/@id != 'test_context'">
                Its id is not 'test_context'.ATTRIBUTEidATTRIBUTE
    </sch:assert>
</sch:rule>
Then if there is a context in dsectxt.xml file, and the value of its attribute id is "test_context", BTT Validation Tool will detect this error and report the error to you.

Screen capture of the dsectxt.xml file