XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Validation, Schematron and the role attribute

Hi,

we are playing with different aspects of validation of xml documents. We would like to understand how validation with Schematron really works.

 

As an example let’s have a look at a language for reporting examination results:

 

# examination grade from A (best) to F (failed)

grade = "A" | "B" | "C" | "D" | "E" | "F"

# exam result consists of pupils name and the grades for English and math

result =

    element result {

        element name { text },

        element english { grade },

        element math { grade }

    }

# examination results for a group of pupils

start = element results { result+ }

 

I would like to use schematron to enforce a business rule: for each individual there must not be two or more results in the list. I would also use Schematron to inform me when someone is detected who is very good in math and good enough in English (kind of a side-effect). Which leads to this schema:

 

<sch:pattern>

        <sch:rule context="result">

            <sch:let name="pupil" value="name"/>

            <sch:assert role="error" test="not(preceding-sibling::result[name eq $pupil])">We

                already had an result for <sch:value-of select="$pupil"/></sch:assert>

        </sch:rule>

    </sch:pattern>

 

    <sch:pattern>

        <sch:rule context="result[math eq 'A']">

            <sch:let name="pupil" value="name"/>

            <sch:report role="information" test="english = ('A', 'B')">Get in touch with

                    <sch:value-of select="$pupil"/>, maybe he/she will join us</sch:report>

        </sch:rule>

    </sch:pattern>

 

Question is: is this document valid or invalid with respect to the given Schematron schema?

 

<results>

    <result>

        <name>John</name>

        <english>B</english>

        <math>A</math>

    </result>

</results>

 

My answer as the designer of the Language would be „YES of course it is valid, that’s why I marked the second rule as ‘information’“. Since the @role attribute is “A name describing the function of the assertion or context node in the pattern” [ISO/IEC 19757-3 5.5.11], the function of the second assertion is to act as an information only.

 

But why not ask a general Schematron validator? I understand that the skeleton reference implementation, when applied to schema given above, generates a validator in XSL. According to [ISO/IEC 19757-3 6.1], it should be a function returning “valid”, “invalid” or “error. However, the XSL Script which is generated by the skeleton implementation generates an SVRL document which does not explicit state that the document is “valid” or “invalid”. Instead, it contains this element:

 

<svrl:successful-report test="english = ('A', 'B')"

                           role="information"

                           location="/results[1]/result[1]">

      <svrl:text>Get in touch with

                    John, maybe he/she will join us</svrl:text>

   </svrl:successful-report>

 

Does the “successful report” and the “information” level indicate that the document is valid? What if I had used the equivalent <sch:assert test=’not(…)’ /> syntax, which would generate a failed-assert element?

 

I am puzzled. Does the existence of any successful-report or failed-assert element in SVRL indicate that the document is invalid? Or is it my own interpretation of the SVRL Elements together with the @role attribute what the result really means in terms of valid or invalid?

 

Thanks in advance,

Frank Steimke



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS