Skip to content

Suggestion for improvement on Schematron design #5

@phax

Description

@phax

Hi guys,
while adopting the SETU Schematron for my phive-rules library I stumbled upon a small design glitch in your Schematron design.

You are actually using an empty pattern for every rule (taken from the Timecard 1.4):

    <sch:pattern>
        <sch:rule id="nl.setu.2007.businessrules.timecard.businessrule.Id.1" fpi="Controleren of het Id element aanwezig is, en het attribuut idOwner en het element IdValue bevat." context="/setu:TimeCard" flag="error">
            <sch:assert test="(count(setu:Id) = 1) and (normalize-space(setu:Id) != '') and         (count(setu:Id/@idOwner) = 1) and (normalize-space(setu:Id/@idOwner) != '') and         (count(setu:Id/setu:IdValue) = 1) and (normalize-space(setu:Id/setu:IdValue) != '')">
                A timecard should have exactly one Id element, with exactly one idOwner attribuut and one IdValue element.
            </sch:assert>
        </sch:rule>
    </sch:pattern>
    <sch:pattern>
        <sch:rule id="nl.setu.2007.businessrules.timecard.businessrule.Id.2" fpi="Controleren of het attribuut idOwner van het Id element de juiste waarde bevat." context="/setu:TimeCard/setu:Id" flag="error">
            <sch:assert test="(normalize-space(@idOwner) = 'StaffingCustomer') or (normalize-space(@idOwner) = 'StaffingCompany')  ">
                The idOwner attribute of Id should have the value 'StaffingCustomer'.
            </sch:assert>
        </sch:rule>
    </sch:pattern>

When this is translated to XSLT it means, that everytime the whole document is traversed again which decreases execution speed. Each pattern element becomes its own "XSLT mode". By combining all rules that belong to the same pattern context (in your case an empty string), the execution speed could be improved.

hth and BR, Philip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions