W3C

Schematron Quick Fixes Specification

Quick-fix support for XML Community Group - Draft April 2015

This version:
http://schematron-quickfix.github.io/sqf/publishing-snapshots/April2015Draft/spec/SQFSpec.html
Latest version:
http://schematron-quickfix.github.io/sqf
Editors:
Nico Kutscherauer
Octavian Nadolu

Abstract

Schematron QuickFix is an extension of the ISO standard Schematron. With Schematron QuickFix the developer is able to define QuickFixes for the Schematron errors. The implementation should offer the user these QuickFixes for the reported Schematron errors. With just one click the user can decide which QuickFix acceptably fixes the error.

Status of this Document

This specification was published by the Quick-fix support for XML Community Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply. Learn more about W3C Community and Business Groups.

First Draft

Table of Contents

1 Namespaces and prefixes
2 Terminology
3 Introduction
    3.1 Fix
    3.2 Quick fix
4 Language
    4.1 Embedding into Schematron
    4.2 QuickFix
        4.2.1 Definition of a QuickFix
        4.2.2 QuickFixes ID
        4.2.3 Reference to a QuickFix
        4.2.4 Execution of a QuickFix
            4.2.4.1 Execution of more than one QuickFix
        4.2.5 QuickFix group
        4.2.6 Scope of QuickFixes and QuickFix groups
    4.3 Change commands
        4.3.1 Anchor node
        4.3.2 Conditions
        4.3.3 Create new content
            4.3.3.1 By SQF attributes
            4.3.3.2 By an XPath expression
            4.3.3.3 By the Activity Element content
        4.3.4 Conflicts
        4.3.5 Kind of the change commands
            4.3.5.1 Add
            4.3.5.2 Delete
            4.3.5.3 Replace
            4.3.5.4 StringReplace
    4.4 User Entry
    4.5 Variables and parameter
    4.6 Embedding XPath
        4.6.1 Attributes to embed XPath expressions
        4.6.2 Attribute Value Template
5 Implementation modes
    5.1 XML save mode
    5.2 XSLT only mode
6 Schematron QuickFix reference
    6.1 Elements
        6.1.1 <sqf:add>
            6.1.1.1 Parent elements
            6.1.1.2 Child elements
            6.1.1.3 Attributes
                6.1.1.3.1 @position
                6.1.1.3.2
            6.1.1.4 Content model
        6.1.2 <sqf:call-fix>
            6.1.2.1 Parent elements
            6.1.2.2 Child elements
            6.1.2.3 Attributes
                6.1.2.3.1 @ref
                6.1.2.3.2
            6.1.2.4 Content model
        6.1.3 <sqf:delete>
            6.1.3.1 Parent elements
            6.1.3.2 Attributes
                6.1.3.2.1
            6.1.3.3 Content model
        6.1.4 <sqf:description>
            6.1.4.1 Parent elements
            6.1.4.2 Child elements
            6.1.4.3 Attributes
                6.1.4.3.1 @xml:lang (optional)
                6.1.4.3.2
            6.1.4.4 Content model
        6.1.5 <sqf:fix>
            6.1.5.1 Parent elements
            6.1.5.2 Child elements
            6.1.5.3 Attributes
                6.1.5.3.1 @id
                6.1.5.3.2 @role
                6.1.5.3.3 @use-when
                6.1.5.3.4 @xml:lang (optional)
                6.1.5.3.5
            6.1.5.4 Content model
        6.1.6 <sqf:fixes>
            6.1.6.1 Child elements
            6.1.6.2 Attributes
                6.1.6.2.1 @id
                6.1.6.2.2 @xml:lang (optional)
                6.1.6.2.3
            6.1.6.3 Content model
        6.1.7 <sqf:group>
            6.1.7.1 Parent elements
            6.1.7.2 Child elements
            6.1.7.3 Attributes
                6.1.7.3.1 @id
                6.1.7.3.2 @use-when
                6.1.7.3.3 @xml:lang (optional)
                6.1.7.3.4
            6.1.7.4 Content model
        6.1.8 <sqf:keep>
            6.1.8.1 Attributes
                6.1.8.1.1 @select
            6.1.8.2 Content model
        6.1.9 <sqf:p>
            6.1.9.1 Parent elements
            6.1.9.2 Child elements
            6.1.9.3 Attributes
                6.1.9.3.1 @xml:lang (optional)
                6.1.9.3.2
            6.1.9.4 Content model
        6.1.10 <sqf:param>
            6.1.10.1 Exception
            6.1.10.2 Parent elements
            6.1.10.3 Attributes
                6.1.10.3.1 @abstract
                6.1.10.3.2 @required
                6.1.10.3.3
                6.1.10.3.4
            6.1.10.4 Content model
        6.1.11 <sqf:replace>
            6.1.11.1 Parent elements
            6.1.11.2 Child elements
            6.1.11.3 Attributes
                6.1.11.3.1
            6.1.11.4 Content model
        6.1.12 <sqf:stringReplace>
            6.1.12.1 Parent elements
            6.1.12.2 Child elements
            6.1.12.3 Attributes
                6.1.12.3.1 @regex
                6.1.12.3.2 @select
                6.1.12.3.3
            6.1.12.4 Content model
        6.1.13 <sqf:title>
            6.1.13.1 Parent elements
            6.1.13.2 Child elements
            6.1.13.3 Attributes
                6.1.13.3.1 @xml:lang (optional)
                6.1.13.3.2
            6.1.13.4 Content model
        6.1.14 <sqf:user-entry>
            6.1.14.1 Parent elements
            6.1.14.2 Child elements
            6.1.14.3 Attributes
                6.1.14.3.1 @xml:lang (optional)
                6.1.14.3.2
                6.1.14.3.3
            6.1.14.4 Content model
        6.1.15 <sqf:with-param>
            6.1.15.1 Parent elements
            6.1.15.2 Attributes
                6.1.15.2.1 @name
                6.1.15.2.2 @select
                6.1.15.2.3
            6.1.15.3 Content model
    6.2 Element groups
        6.2.1 sqf:activityElements
            6.2.1.1 Used by
            6.2.1.2 Elements
            6.2.1.3 Content model
        6.2.2 sqf:fixElements
            6.2.2.1 Used by
            6.2.2.2 Elements
            6.2.2.3 Content model
        6.2.3 sqf:foreign
            6.2.3.1 Used by
            6.2.3.2 Elements
            6.2.3.3 Content model
        6.2.4 sqf:foreign-element
            6.2.4.1 Used by
            6.2.4.2 Content model
        6.2.5 sqf:templateElements
            6.2.5.1 Used by
            6.2.5.2 Content model
    6.3 Attribute groups
        6.3.1 activityBase
            6.3.1.1 Used by
            6.3.1.2 Attributes
                6.3.1.2.1 @match
                6.3.1.2.2 @use-when
                6.3.1.2.3
            6.3.1.3 Content model
        6.3.2 activityManipulate
            6.3.2.1 Used by
            6.3.2.2 Attributes
                6.3.2.2.1 @node-type
                6.3.2.2.2 @select
                6.3.2.2.3 @target
                6.3.2.2.4
            6.3.2.3 Content model
        6.3.3 messageAttributes
            6.3.3.1 Attributes
                6.3.3.1.1 @default-fix
                6.3.3.1.2 @fix
            6.3.3.2 Content model
        6.3.4 parameterAttributes
            6.3.4.1 Used by
            6.3.4.2 Attributes
                6.3.4.2.1 @default
                6.3.4.2.2 @name
                6.3.4.2.3 @type
            6.3.4.3 Content model
        6.3.5 rootAttributes
            6.3.5.1 Attributes
                6.3.5.1.1 @version
            6.3.5.2 Content model

Appendix

A Schematron Quick Fixes schema


1 Namespaces and prefixes

This document describes the nodes which belong to different namespaces. For distinction and for unique descriptions all nodes, which do not belong to the NULL namespace, are named with a prefix. The following table assigns to each used prefix the corresponding namespace URI:

PrefixNamespace URICorresponding standard
schhttp://purl.oclc.org/dsdl/schematronISO Schematron
sqfhttp://www.schematron-quickfix.com/validator/processSchematron QuickFix
xslhttp://www.w3.org/1999/XSL/TransformXSLT 2.0

2 Terminology

Schematron assertion

Condition which is declared by the Schematron elements sch:report or sch:assert.

A failed Schematron assertion produces a Schematron error. One Schematron assertion can produce multiple Schematron errors.

Schematron rule

According to the Schematron element sch:rule. It contains one or more Schematron assertions.

Context

The context of a Schematron rule is defined by the attribute context. If a rule matches to more than one node, it has more than one context.

Schematron error

A Schematron error occurs if a Schematron assertion failed.

Context

The context of the Schematron error is the node, which was matched by the Schematron rule, when the Schematron assertion failed.

The attribute subject has no affect to the context of the Schematron error. Unlike to the context of the Schematron rule, the Schematron error has only one context node.

3 Introduction

This section describes the classification of the based concepts of Schematron QuickFix.

3.1 Fix

A fix is a change of a document, applied to an occurred error. All changes must have the object to solve this error. Requirement is to detect the error.

3.2 Quick fix

A Quick fix is a fully automatic implemented fix. In connection with an error (produced by a validation of a document) one ore more Quick fixes are offered to execute. A user can choose the Quick fix, which is executed by a fully automated process.

A Quick fix requires:

  1. Instructions, written in a document processing language, to implement the fix. The instructions have to designed in a way, that it is able to process them applied to a context. The context is defined by the occurred error.

  2. A human-readable description of the Quick fix. The description should be displayed to the user, when he chooses the Quick fix.

It is able to define Quick fixes inside of a validation parser or using a therefore designed script language. First, there is a limited quantity of Quick fixes, in the second case the quantity is unlimited.

It depends on the quantity of unique kinds of errors from the validation language, which way makes more sense. Is the quantity of kinds of errors limited, an implementation of Quick fixes inside of the parser is possible.

Requirements:

  • Links to or embedding into the parser or a validation language.

  • A workflow to execute the Quick fixes.

  • Graphical user interface to choose the Quick fixes.

4 Language

Schematron QuickFix (SQF) is an extension of the validation language Schematron to embed Quick fixes. The language uses additional concepts, which should be explained in this section.

4.1 Embedding into Schematron

To embed Schematron QuickFix into Schematron, all extending elements should have the namespace http://www.schematron-quickfix.com/validator/process (prefix sqf).

The following table shows the permitted parent-child relations between the namespaces of SQF and Schematron.

Parent elementPermitted children
sch:schema
  • sqf:fixes

sch:rule
  • sqf:fix

  • sqf:group

sqf:title
  • sch:name

  • sch:value-of

sqf:p
  • sch:name

  • sch:value-of

  • sch:emph

  • sch:dir

  • sch:span

sqf:fix
  • sch:let

The following table shows which attributes from the SQF namespace should be permitted of which Schematron elements:

Schematron elementPermitted SQF attribute
sqf:assert
  • sqf:fix

  • sqf:default-fix

sqf:report
  • sqf:fix

  • sqf:default-fix

4.2 QuickFix

Note:

Please note the different spelling of QuickFix and Quick fix. The spelling QuickFix means a Quick fix of the extension language Schematron QuickFix. The spelling Quick fix means a not specific Quick fix, which was described in the section Quick fix.

A QuickFix is consequently a Quick fix of the language Schematron QuickFix.

A QuickFix requires the following properties:

A QuickFix is able to have the following additional properties:

  • Additional description

  • Condition to provide the QuickFix

  • User Entry to parametrise the QuickFix (see User Entries)

4.2.1 Definition of a QuickFix

The QuickFix is defined by the sqf:fix element. The requirements will be satisfied with the following base structure:

<sqf:fix id="fix1">
    <sqf:description>
        <sqf:title>Fix 1</sqf:title>
    </sqf:description>
    [Elements from the content model  (sqf:delete | sqf:add | sqf:replace | sqf:stringReplace)+]
</sqf:fix>

The defined QuickFix above has the following properties:

  • Title: Fix 1

  • ID: fix1

  • One or more change commands: not specified yet.

4.2.2 QuickFixes ID

The ID of the QuickFix and the QuickFix groups (see below) is the Identifier for references to QuickFixes and QuickFix groups.

Requirements to set the ID:

  • The ID has to correspond with the XSD type xs:NCName.

  • Inside of a Schematron rule the ID must be unique.

  • Global QuickFixes or QuickFix groups should not have the same IDs.

In the following cases it is permitted that two QuickFixes, QuickFix groups or a QuickFix and a QuickFix group have the same IDs:

  • One is global the other is local.

  • Both are local and declared in different Schematron rules.

4.2.3 Reference to a QuickFix

Schematron assertions are able to refer to one or more QuickFixes. Therefore the sqf:fix attribute contains a whitespace separated list of IDs. Each ID refers to an ID of a QuickFix.

The sch:assert element refers to the QuickFixes with the ID "fix1" and "fix2":

<sch:assert test="[...]" sqf:fix="fix1 fix2">[...]</sch:assert>
<sqf:fix id="fix1"> 
    [...] 
</sqf:fix> 
<sqf:fix id="fix2">
    [...] 
</sqf:fix>

Is a Schematron assertion producing a Schematron error that refers to a QuickFix, a Schematron QuickFix implementation needs to provide the QuickFix as a choice for the user in connection to the occurred error.

Exception: A QuickFix, which condition was not satisfied in the context of the Schematron error, should not be provided.

The user should be able to execute each provided QuickFix.

4.2.4 Execution of a QuickFix

During the execution process of a QuickFix each command changes will be executed in the context node of the error, if their condition was satisfied in this context.

4.2.4.1 Execution of more than one QuickFix

It is free to the implementation to allow executions of more than one QuickFix at once. But a execution of more than one QuickFix of the same Schematron error at once are not permitted.

It is up to the implementation to warn the user against possible conflicts or to hide QuickFixes to avoid such conflicts.

4.2.5 QuickFix group

A QuickFix group is a set of one or more QuickFixes. Additional it needs an ID, which is equal to the ID of a QuickFix. The QuickFix will be implemented with the sqf:group element.

A Schematron assertion is able to refer to a QuickFix group on the same way it refers to a QuickFix. A reference to a QuickFix groups is equal to references to all QuickFixes which the QuickFix group contains.

The QuickFix group has the ID groupid and contains the QuickFixes with the IDs fix1 and fix2.

The first sch:assert element refers to the QuickFixes fix1 and fix2 per QuickFix ID. The second one refers to the same QuickFixes per ID of the QuickFix group.

<sch:assert test="[...]" sqf:fix="fix1 fix2">[...]</sch:assert>
<sch:assert test="[...]" sqf:fix="groupid">[...]</sch:assert>
<sqf:group id="groupid">
     <sqf:fix id="fix1"> [...] </sqf:fix>
     <sqf:fix id="fix2"> [...] </sqf:fix>
</sqf:group>

4.2.6 Scope of QuickFixes and QuickFix groups

A QuickFix or a QuickFix group can be defined global or local. Local QuickFixes or QuickFix groups are declared inside of the Schematron rule and only the assertions of this rule are able to refer to the QuickFixes or QuickFix group. Global QuickFixes or QuickFix groups are declared inside of the sqf:fixes element and available for all Schematron assertions.

Example for a global QuickFix:

<sch:schema> 
     [...] 
     <sqf:fixes>
          <sqf:fix id="fix2"> [...] </sqf:fix>
     </sqf:fixes>
</sch:schema>

Example for a local QuickFix:

<sch:rule context="[...]">
     [...] 
     <sqf:fix id="fix1"> [...] </sqf:fix>
</sch:rule>

4.3 Change commands

A QuickFix needs at least one change command. A change command is implemented by an activity element (see element group sqf:activityElements). A change command is processed relative to an anchor node.

4.3.1 Anchor node

The anchor node is the context of a change command. By default the context of the Schematron error is the anchor node.

To specify anchor nodes, the match attribute is provided to each activity element. If an activity element points to more than one anchor node, for each anchor node the change command will be executed. If an activity element points to no anchor node, no change command will be executed.

4.3.2 Conditions

Each change command can have a condition to execute. Therefore the attribute use-when is provided to each activity element. The condition will be defined in the context of the Schematron errors. If the condition is not satisfied the change command should not be executed.

4.3.3 Create new content

Depending of the kind, the change command may create new content to insert it into or replace nodes from the document. There are three ways to create new content:

4.3.3.1 By SQF attributes

To create a new node, the change command may provide the attributes type and target. This attributes create exact one node.

To create a new node the attribute type provides the following values:

  • "keep"

    To create a node from the same type as the anchor node.

  • "element"

    To create a element.

  • "attribute"

    To create a attribute

  • "processing-instruction" or "pi"

    To create a processing instruction

  • "comment"

    To create a comment

If the type attribute has not the value "comment", the attribute target is required. It sets the name of the created node. The value of the target attribute will be interpreted as an attribute value template. The effective value should be valid to the XSD type xs:QName.

If an Activity Element has an target attribute, the type attribute is required.

If the type attribute has the value "element" (or "keep" and the anchor element is an element), the content of the new element will be created by XPath or by the content of the Activity Element.

If the type attribute has the values "attribute", "processing-instruction", "pi" or "comment" (or "keep" and the anchor node is not an element), the value of the new node will be created by XPath or by the content of the Activity Element. If this returns nodes, the value will be created by the values of this nodes. More than one node value will be connected to one node value separated by whitespace.

4.3.3.2 By an XPath expression

To define the new content by an XPath expression, the select attribute is provided.

  • If the XPath expression returns an atomic value, the value will be transformed into an text node.

  • If the XPath expression returns a sequence of atomic values, all values will be transformed to a text node. The values will be separated by whitespace.

  • If the XPath expression returns one or more nodes, the nodes will be copied into the document.

If the Activity Element has a select attribute, the element should be empty.

4.3.3.3 By the Activity Element content

The content of the Activity Elements has the same functionality as the content of xsl:template elements from the XSLT 2.0 Recommendation. This means:

  • Elements from the XSLT namespace will be processed in the context of the change command. If XSLT elements are able to change the context in XSLT, this should have the same effect to there descendents in SQF.

  • Elements which not belong to the XSLT, SQF or Schematron namespace will be processed as Literal Result Elements.

Extensions of the XSLT template behavior:

  • Elements from the SQF namespace will be processed as it is defined in this specification. Permitted elements are:

    • sqf:keep

  • Elements from the Schematron namespace will be processed as it is defined in the Schematron specification. Permitted elements are:

    • sch:let

    • sch:value-of

    • sch:name

4.3.4 Conflicts

A conflict is thrown, if there are more than one change command for the same anchor node, during an QuickFix execution. There are two kinds of conflicts:

  • Resolvable conflict

    If the conflict is between two or more change commands which belongs to the same QuickFix, the conflict is resolvable. In this case, the change command will be executed, whose activity element is defined at first inside of the sqf:fix element.

  • Warning raised conflict

    If two or more change commands from different QuickFixes are in conflict, the conflict is not resolvable. A warning should be produced. The implementation is free to decide which QuickFix has hire priority. This kind of a conflict is just posible, if an implementation allows to execute more than one QuickFix at once.

4.3.5 Kind of the change commands

There are four predefined kinds of change commands:

  • Add

  • Delete

  • Replace

  • StringReplace

Delete

Deletes the anchor node.

Replace

Replaces the anchor node by one or more nodes.

StringReplace

Replaces substrings of the anchor node by one or more nodes. The anchor node needs to be a text node for this change command.

A Schematron QuickFix implementation is free to provide extending Change commands. The extending change commands should provide the attributes of the attribute group activityBase.

4.3.5.1 Add

Creates one or more nodes and insert it relative to the anchor node. The new content can be created by the SQF attributes, by XPath or by the content of the sqf:replace element.

4.3.5.2 Delete

This change command deletes the anchor node.

4.3.5.3 Replace

The anchor node will be replaced by new content. The new content can be created by the SQF attributes, by XPath or by the content of the sqf:replace element.

4.3.5.4 StringReplace

The anchor node has to be a text node. To analyze the text node, the regex attibute is required. The attribute value of the regex attribute will be interpreted as an attribute value template. The effective value should be a valid Regular Expression corresponding to the XSLT 2.0 Recommendation.

Any substrings, which matches to this Regular Expression, will be replaced by new content. The new content can be creatded by XPath or by the content of the sqf:stringReplace element.

4.4 User Entry

To be done.

4.5 Variables and parameter

To be done.

4.6 Embedding XPath

Schematron QuickFix is based on the W3C Recommendation XPath 2.0. Any XPath expression of the Schematron schema needs to match the syntax allowed by the XPath grammar.

4.6.1 Attributes to embed XPath expressions

The following table shows attributes, whose value will be parsed as XPath expressions, corresponding to the XPath 2.0 Recommendation:

AttributeElementContextDescriptionRequired return type
defaultsqf:paramcontext of the Schematron errorDefault value for the parameterno requirement
sqf:user-entrycontext of the Schematron errorDefault value for User Entryno requirement
matchsqf:addcontext of the Schematron errorContexts of the change commandsnode()*
sqf:deletecontext of the Schematron errorContexts of the change commandsnode()*
sqf:replacecontext of the Schematron errorContexts of the change commandsnode()*
sqf:stringReplacecontext of the Schematron errorContexts of the change commandstext()*
selectsqf:addAnchor nodeNodes or atomic values, which should be insertedno requirement
sqf:keepInherits from the parent node.Nodes to copy or apply to other change commandsnode()*
sqf:replaceAnchor nodeNodes or atomic values, which should be insertedno requirement
sqf:stringReplaceAnchor nodeNodes or atomic values, which should be insertedno requirement
sqf:with-paramcontext of the Schematron errorValue for the parameterno requirement
use-whensqf:addAnchor nodeCondition to process the change commandno requirement, interpreted as boolean
sqf:deleteAnchor nodeCondition to process the change commandno requirement, interpreted as boolean
sqf:replaceAnchor nodeCondition to process the change commandno requirement, interpreted as boolean
sqf:stringReplaceAnchor nodeCondition to process the change commandno requirement, interpreted as boolean
sqf:fixcontext of the Schematron errorCondition to provide the QuickFixno requirement, interpreted as boolean
sqf:groupcontext of the Schematron errorCondition to provide all QuickFixes of this QuickFix groupno requirement, interpreted as boolean

4.6.2 Attribute Value Template

The following table shows attributes, whose value is interpreted as attribute value template corresponding to the XSLT 2.0 Recommendation:

AttributeElementContextEffective value requirements
regexsqf:stringReplaceAnchor nodeValid Regular Expression corresponding to the XSLT 2.0 Recommendation.
targetsqf:addAnchor nodexs:QName
sqf:replaceAnchor nodexs:QName

The effective value requirements should be satisfied after interpreting the attribute value template.

5 Implementation modes

A QuickFix can be implemented in two different modes:

An implementation is free to implement only one or both modes.

5.1 XML save mode

The XML save mode requires that no changes will be applied to the document, which are not defined by the executed QuickFix. Changes which are caused by an XSLT processor (skip the XML declaration, resolving default attributes, CDATA sections, etc.) any time, should not influence the document. That is why it is not possible to implement the XML save mode with only XSLT processes.

5.2 XSLT only mode

If an implementation is based only on XSLT processes, this is called the XSLT only mode. In this case, it is allowed to change the document on any QuickFix execution in the following ways, though it is not defined in the QuickFix:

  • Skip the XML declaration

  • Skip the DOCTYPE declaration

  • Skip whitespace:

    • which are outside of the root element and not in processing instructions and comments.

    • non significant whitespace

  • Normalize whitespace

    • Leading whitespace of content in processing instructions in prolog

    • between attributes

  • Resolve default attributes to encoded attributes

  • Resolve CDATA sections

  • Resolve Character entities.

6 Schematron QuickFix reference

6.1 Elements

6.1.1 <sqf:add>

This activity element adds a node to one or more nodes of the XML instance.

The attributes match and position define the position where the nodes will be added. The position is determined by the anchor node(s) (@match) and the insertion direction (@position).

The attributes node-type, select and target and the content of the element define the nodes to be added.

6.1.1.1 Parent elements
6.1.1.2 Child elements
6.1.1.3 Attributes
6.1.1.3.1 @position
Description The position attribute defines the position of the nodes to be added relatively to the anchor node (see @match).
Use optional
Default If the value of the node-type attribute is "attribute", the position attribute should not be set, because the node to be added will always be inserted as attribute. Otherwise the default value is "first-child".
Value
  • "after"

    The nodes to be added will be inserted after the anchor node.

  • "before"

    The nodes to be added will be inserted before the anchor node.

  • "first-child"

    The nodes to be added will be inserted as the first child of the anchor node.

  • "last-child"

    The nodes to be added will be inserted as the last child of the anchor node.

6.1.1.3.2

See attribute group sqf:activityManipulate .

6.1.1.4 Content model

6.1.2 <sqf:call-fix>

This element calls another QuickFix within a QuickFix. The called QuickFix must be defined globally or for the same Schematron rule as the calling QuickFix. A calling QuickFix should not have other activity elements.

The calling QuickFix adopts the activity elements of the called QuickFix. With the help of parameters, these can be specified (see sqf:with-param ).

The description and other characteristics (e.g. @use-when) of the called QuickFix will not be adopted.

6.1.2.1 Parent elements
6.1.2.2 Child elements
6.1.2.3 Attributes
6.1.2.3.1 @ref
Description This attribute refers to a QuickFix by using the ID. The referred QuickFix must be defined globally or for the same Schematron rule as the referring QuickFix.
Use required
Value xs:string
6.1.2.3.2

See attribute group sch:foreign .

6.1.2.4 Content model

6.1.3 <sqf:delete>

This activity element deletes one or more nodes of the XML instance.

The match attribute defines the nodes to be deleted.

6.1.3.1 Parent elements
6.1.3.2 Attributes
6.1.3.2.1

See attribute group sqf:activityBase .

6.1.3.3 Content model

6.1.4 <sqf:description>

Adds a human readable description to the parent element.

6.1.4.1 Parent elements
6.1.4.2 Child elements
6.1.4.3 Attributes
6.1.4.3.1 @xml:lang (optional)
6.1.4.3.2

See attribute group sch:foreign .

6.1.4.4 Content model

6.1.5 <sqf:fix>

Defines a Schematron QuickFix with its content. All commands will be processed if the QuickFix is activated by the user.

6.1.5.1 Parent elements
6.1.5.3 Attributes
6.1.5.3.1 @id
Description The ID to reference the QuickFix.
Use required
Value xs:NCName
6.1.5.3.2 @role
Description With this attribute the role of the QuickFix can be set manually. The role of a QuickFix describes the type of change which it makes. If the role is not set manually, the role is the type of the used activity element ("add", "delete", "replace" or "stringReplace"). If two different activity elements are used in a QuickFix, the role is automatically "mix".
Use optional
Value
  • "replace"

  • "add"

  • "stringReplace"

  • "delete"

  • "mix"

6.1.5.3.3 @use-when
Description The condition to provide the QuickFix.
Use optional
Default "true()"
Value xs:string
6.1.5.3.4 @xml:lang (optional)
6.1.5.3.5

See attribute group sch:foreign .

6.1.5.4 Content model

6.1.6 <sqf:fixes>

Contains globally useable Schematron QuickFixes and QuickFix groups.

6.1.6.1 Child elements
6.1.6.2 Attributes
6.1.6.2.1 @id
Use optional
Value xs:ID
6.1.6.2.2 @xml:lang (optional)
6.1.6.2.3

See attribute group sch:foreign .

6.1.6.3 Content model

6.1.7 <sqf:group>

Defines a Schematron QuickFix group. If the group is linked by an assert or report, all QuickFixes of this group will be accosieted with the assert/report.

6.1.7.1 Parent elements
6.1.7.2 Child elements
6.1.7.3 Attributes
6.1.7.3.1 @id
Description The ID to reference the QuickFix group.
Use required
Value xs:string
6.1.7.3.2 @use-when
Description The condition to provide the QuickFixes of the QuickFix group.
Use optional
Default "true()"
Value xs:string
6.1.7.3.3 @xml:lang (optional)
6.1.7.3.4

See attribute group sch:foreign .

6.1.7.4 Content model

6.1.8 <sqf:keep>

This element is available within activity elements. The function is to copy nodes selected by the select attribute. Unlike a deep copy function, with this function the copied nodes can be manipulated by the current or other activity elements.

6.1.8.1 Attributes
6.1.8.1.1 @select
Description The attribute selects nodes to be copied.
Use optional
Default "node()"
Value xs:string XPath expression.
6.1.8.2 Content model

6.1.9 <sqf:p>

Paragraph within a description.

6.1.9.1 Parent elements
6.1.9.2 Child elements
6.1.9.3 Attributes
6.1.9.3.1 @xml:lang (optional)
6.1.9.3.2

See attribute group sch:foreign .

6.1.9.4 Content model

6.1.10 <sqf:param>

This element defines a parameter for a QuickFix. The parameter can be used like a variable within the QuickFix. The value can be set by the sqf:with-param element.

The content defines a default value for the parameter.

6.1.10.1 Exception

Abstract parameters (see attribute abstract) can not used as normal XPath variables. An abstract parameter declares, that the current QuickFix uses a parameter of an abstract pattern. A QuickFix with one or more abstract parameters can just used by abstract patterns. The value of the parameter will be set by the instantiation of the abstract pattern according to the Schematron specification. The instantiation of the abstract pattern must specify a value for every abstract parameter of the QuickFix.

6.1.10.2 Parent elements
6.1.10.3 Attributes
6.1.10.3.1 @abstract
Description This attribute sets for the parameter whether it is abstract or not. The current quick fix can be instantiate only from an abstract pattern that defines this abstract parameter. Inside of a global QuickFix every used parameter of an abstract pattern must be declared by an abstract parameter. If a parameter is defined as abstract, it can not have a type, required or default attribute. Its value will be only form the abstract pattern instantiation.
Use optional
Default "false"
Value xs:boolean The value "true" is used for abstract parameter, "false" for regular parameter.
6.1.10.3.2 @required
Description This attribute sets for the parameter whether it is optional or required. If the parameter is required, it cannot have a default attribute or any content.
Use optional
Default "no"
Value
  • "yes"

  • "no"

The value "yes" is used for required, "no" for optional.
6.1.10.3.3

See attribute group sch:foreign .

6.1.10.3.4

See attribute group sqf:parameterAttributes .

6.1.10.4 Content model

6.1.11 <sqf:replace>

This activity element replaces one or more nodes of the XML instance by a node. The activity command combines the delete and the add command.

The nodes to be deleted are defined by the match attribute. The nodes to be added are defined by the the attributes node-type and select and the content of the sqf:replace element.

The position of the nodes to be added is the position of the nodes to be deleted.

6.1.11.1 Parent elements
6.1.11.2 Child elements
6.1.11.3 Attributes
6.1.11.3.1

See attribute group sqf:activityManipulate .

6.1.11.4 Content model

6.1.12 <sqf:stringReplace>

This activity element replaces substrings of text nodes by other nodes. The text nodes are defined by the match attribute. The regex attribute defines the substrings of the text nodes.

The nodes to be inserted are defined by the content of the sqf:stringReplace element or the select attribute. Note: The context within the sqf:stringReplace element is set to the substrings. So, it is an atomic value.

6.1.12.1 Parent elements
6.1.12.2 Child elements
6.1.12.3 Attributes
6.1.12.3.1 @regex
Use required
Value xs:string Regular expression. The expression can be specified by XPath expressions which are marked by curly brackets. After processing, the regular expression must meet the requirements of the regex attribute of the xsl:analyze-string element.
6.1.12.3.2 @select
Description The select attribute defines nodes or an atomic value as the nodes to be inserted. If the select attribute is set, the sqf:stringReplace element should be empty. The selected nodes will be copied. Unlike a deep copy function, the copied nodes could be manipulated by the current or other activity elements.
Use optional
Default There is no default value. If the select attribute is not set, the content of the activity element defines the nodes to be inserted.
Value xs:string XPath expression. The context of relative expressions is the substring to replace. Note: The context will be always an atomic value. To select nodes from the XML instance, the use of variables outside of the sqf:stringReplace element is necessary.
6.1.12.3.3

See attribute group sqf:activityBase .

6.1.12.4 Content model

6.1.13 <sqf:title>

Name of a QuickFix or a user entry.

6.1.13.1 Parent elements
6.1.13.2 Child elements
6.1.13.3 Attributes
6.1.13.3.1 @xml:lang (optional)
6.1.13.3.2

See attribute group sch:foreign .

6.1.13.4 Content model

6.1.14 <sqf:user-entry>

Defines an user entry. With the help of the user entry, the user can interact with the QuickFix. The user entry refers to a sqf:param element. The value of the parameter is set manually by the user. The implementation should provide the user entry when the user selects the QuickFix.

6.1.14.1 Parent elements
6.1.14.2 Child elements
6.1.14.3 Attributes
6.1.14.3.1 @xml:lang (optional)
6.1.14.3.2

See attribute group sch:foreign .

6.1.14.3.3

See attribute group sqf:parameterAttributes .

6.1.14.4 Content model

6.1.15 <sqf:with-param>

With the help of this element, QuickFix calls can be specified. A sqf:with-param element refers to a parameter of the called QuickFix.

The content or the select attribute define the value of the parameter. If there is content, the sqf:with-param element should not have a select attribute.

6.1.15.1 Parent elements
6.1.15.2 Attributes
6.1.15.2.1 @name
Use required
Value xs:string The name of the referred parameter.
6.1.15.2.2 @select
Description This attribute defines with a XPath expression the value of the parameter. If the attribute is set, the sqf:with-param element must be empty.
Use optional
Value xs:string Must be a valid XPath expression.
6.1.15.2.3

See attribute group sch:foreign .

6.1.15.3 Content model

6.2 Element groups

6.2.1 sqf:activityElements

An activity element defines a change command for one or more nodes of the instance element. This change command is specified by the kind of activity element, the content and several attributes.

6.2.1.1 Used by
6.2.1.3 Content model

6.2.2 sqf:fixElements

Elements to define QuickFixes or QuickFix groups inside of a Schematron schema.

6.2.2.1 Used by
6.2.2.2 Elements
6.2.2.3 Content model

6.2.3 sqf:foreign

6.2.3.1 Used by
6.2.3.2 Elements
6.2.3.3 Content model

6.2.4 sqf:foreign-element

6.2.4.1 Used by
6.2.4.2 Content model

6.2.5 sqf:templateElements

This element group describes the content of the activity elements. The behaviour is similar to the content of the xsl:template element. Additionally, the elements sch:value-of and sch:let are treated as xsl:value-of and xsl:variable. Also the sqf:keep element is available.

6.2.5.2 Content model

6.3 Attribute groups

6.3.1 activityBase

6.3.1.2 Attributes
6.3.1.2.1 @match
Description The match attribute defines anchor nodes for an activity element. For each selected anchor node, the command of the activity element will be executed. For each execution, the context will be set to the anchor node. Exception: The match attribute of the sqf:stringReplace element should only select text nodes.
Use optional
Default "." By default the anchor node is the context node of the related Schematron rule.
Value xs:string XPath expression. The context of relative expressions is the context of the related Schematron rule.
6.3.1.2.2 @use-when
Description A condition for the action of the activity Element. The action will just be executed, if the condition returns true.
Use optional
Default "true()"
Value xs:string
6.3.1.2.3

See attribute group sch:foreign .

6.3.1.3 Content model

6.3.2 activityManipulate

6.3.2.1 Used by
6.3.2.2 Attributes
6.3.2.2.1 @node-type
Description The node-type attribute defines the node type of the nodes to be added. The attribute is required, if the target attribut is set. If the node-type value is missing, the activity element should not have a target attribute. In this case the nodes to be added will be defined by the activity elements content or select attribute.
Use optional
Value
  • "keep"

    The node type of the node to be added will be defined by the anchor node.

  • "element"

    The node to be added will be an element.

  • "attribute"

    The node to be added will be an attribute. The position attribute should not be set.

  • "processing-instruction"

    The node to be added will be a processing instruction.

  • "pi"

    The short notation of "processing-instruction".

  • "comment"

    The node to be added will be a comment. If the value of the node-type attribute is "comment", the activity element should not have a target attribute.

6.3.2.2.2 @select
Description The select attribute defines nodes or an atomic value as the content of the node to be added. If the select attribute is set, the activity element should be empty. The selected nodes will be copied into the node to be added. Unlike a deep copy function, the copied nodes could be manipulated by the current or other activity elements.
Use optional
Default There is no default value. If the select attribute is not set, the content of the activity element defines the content of the nodes to be added.
Value xs:string XPath expression. The context of relative expressions is the anchor node.
6.3.2.2.3 @target
Description This attribute defines the name of the node to be added. The attribute is required if the node-type attribute is specified and the value is not "comment".
Use optional
Value xs:string A string to define a node name. The string can be specified by XPath expressions which are marked by curly brackets. After processing, the name must be valid to the XML Schema type xs:QName. Prefixes must be attached to a namespace in the current context of the Schematron schema. Names without prefixes will be attached to the namespace declared by the sqf:default-namespace element or to the null namespace.
6.3.2.2.4

See attribute group sqf:activityBase .

6.3.2.3 Content model

6.3.3 messageAttributes

Attributes to assign one or more QuickFixes to a Schematron assert or report.

6.3.3.1 Attributes
6.3.3.1.1 @default-fix
Description This attribute sets a default QuickFix for the Schematron assert or report. The default QuickFix must also be referred by the sqf:fix attribute.
Use optional
Value xs:string The ID of a QuickFix which is referred by the sqf:fix attribute.
6.3.3.1.2 @fix
Description This attribute refers to one or more QuickFixes wich should be assigned to the Schematron assert or report. Each referred QuickFix must be defined globally or locally for the same Schematron rule. The reference works with the ID of the QuickFix. If there is a local and a global QuickFix having the same ID, the local QuickFix will be selected.
Use optional
Value xs:string A list of IDs of the referred QuickFixes separated by white space.
6.3.3.2 Content model

6.3.4 parameterAttributes

6.3.4.2 Attributes
6.3.4.2.1 @default
Description This attribute defines a default value for a parameter or User Entry by using a XPath expression. If the attribute is set to a sqf:param element, the element must be empty.
Use optional
Value xs:string Must be a valid XPath expression.
6.3.4.2.2 @name
Description This attribute defines the name of the parameter or User Entry.
Use required
Value xs:string Must be unique within a QuickFix.
6.3.4.2.3 @type
Description This attribute defines the type of the parameter or User Entry.
Use optional
Value xs:string The value should be a valid XML Schema type.
6.3.4.3 Content model

6.3.5 rootAttributes

6.3.5.1 Attributes
6.3.5.1.1 @version
Description The attribute defines the used Schematron QuickFix version. The attribute should be set, if the Schematron schema uses the Schematron QuickFix extensions.
Use optional
Value xs:token
6.3.5.2 Content model

A Schematron Quick Fixes schema

<?xml version="1.0" encoding="UTF-8"?>

<!--  
    Copyright (c) 2014 Nico Kutscherauer
        
    This file is part of Escali Schematron.
    
    Escali Schematron is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    Escali Schematron is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with Escali Schematron.  If not, see http://www.gnu.org/licenses/gpl-3.0.
    
    -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.schematron-quickfix.com/validator/process" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:lang="en">
    <xs:import namespace="http://purl.oclc.org/dsdl/schematron" schemaLocation="iso-schematron.xsd"/>
    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>

    <xs:annotation>
        <xs:appinfo source="sqf:meta">
            <title navTitle="SQF reference">Schematron QuickFix reference</title>
        </xs:appinfo>
        <xs:appinfo source="sqf:meta" xml:lang="de">
            <title navTitle="SQF-Referenz">Schematron QuickFix Referenz</title>
        </xs:appinfo>
    </xs:annotation>

    <xs:annotation>
        <xs:documentation>In this documentation the following expressions will be used. The table bellow shows the definitions of these expressions:</xs:documentation>
        <xs:documentation source="QuickFix">A possible fix for a Schematron report or assert. An implementation should provide it to the user (per default) for each reported assert or report. The QuickFix will be executed if the user chooses it.</xs:documentation>
        <xs:documentation source="Global QuickFix">A QuickFix which is defined in the top-level <icode type="element">sqf:fixes</icode> element. A global QuickFix is available in each Schematron rule.</xs:documentation>
        <xs:documentation source="Local QuickFix">A QuickFix which is defined for a Schematron rule. It is only available in this Schematron rule.</xs:documentation>
        <xs:documentation source="Execute a QuickFix">All activity elements which the QuickFix contains will be performed.</xs:documentation>
        <xs:documentation source="Activity element">implements a change command.</xs:documentation>
        <xs:documentation source="Change command">defined by an activity element for a change of the XML instance. A change command can have the activity kinds "add", "delete", "replace" and "stringReplace".</xs:documentation>
        <xs:documentation source="Add change command">creates one or more nodes and adds them relatively to an anchor node to the XML instance.</xs:documentation>
        <xs:documentation source="Delete change command">deletes one or more nodes.</xs:documentation>
        <xs:documentation source="Replace change command">creates one or more nodes and replaces nodes of the XML instance with them.</xs:documentation>
        <xs:documentation source="String replace change command">creates one or more nodes and replaces substrings of a text node of the XML instance with them.</xs:documentation>
        <xs:documentation source="Anchor node">context node of an activity element. The node is the subject of the change command of the activity element.</xs:documentation>
    </xs:annotation>

    <xs:attributeGroup name="messageAttributes">
        <xs:annotation>
            <xs:documentation xml:lang="de">Attribute zur Zuweisung eins oder mehrerer QuickFixes zu einem Schematron-Assert oder -Report.</xs:documentation>
            <xs:documentation>Attributes to assign one or more QuickFixes to a Schematron assert or report.</xs:documentation>
        </xs:annotation>
        <xs:attribute name="fix" type="xs:string" use="optional" form="qualified">
            <xs:annotation>
                <xs:documentation>This attribute refers to one or more QuickFixes which should be assigned to the Schematron assert or report. Each referred QuickFix must be defined globally or locally for the same Schematron rule.</xs:documentation>
                <xs:documentation>The reference works with the ID of the QuickFix. If there is a local and a global QuickFix having the same ID, the local QuickFix will be selected.</xs:documentation>
                <xs:documentation source="Value">A list of IDs of the referred QuickFixes separated by white space.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="default-fix" type="xs:string" use="optional" form="qualified">
            <xs:annotation>
                <xs:documentation>This attribute sets a default QuickFix for the Schematron assert or report. The default QuickFix must also be referred by the <icode type="attribute">sqf:fix</icode> attribute.</xs:documentation>
                <xs:documentation source="Value">The ID of a QuickFix which is referred by the <icode type="attribute">sqf:fix</icode> attribute.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>
    <xs:attributeGroup name="rootAttributes">
        <xs:attribute name="version" type="xs:token">
            <xs:annotation>
                <xs:documentation>The attribute defines the used Schematron QuickFix version. The attribute should be set, if the Schematron schema uses the Schematron QuickFix extensions.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>

    <xs:attributeGroup name="parameterAttributes">
        <xs:attribute name="name" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>This attribute defines the name of the parameter or User Entry.</xs:documentation>
                <xs:documentation source="Value">Must be unique within a QuickFix.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="default" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>This attribute defines a default value for a parameter or User Entry by using a XPath expression. If the attribute is set to a <icode type="element">sqf:param</icode> element, the element must be empty.</xs:documentation>
                <xs:documentation source="Value">Must be a valid XPath expression.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="type" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>This attribute defines the type of the parameter or User Entry.</xs:documentation>
                <xs:documentation source="Value">The value should be a valid XML Schema type.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>


    <xs:group name="templateElements">
        <xs:annotation>
            <xs:documentation>This element group describes the content of the activity elements. The behavior is similar to the content of the <icode type="element">xsl:template</icode> element. Additionally, the elements <icode type="element">sch:value-of</icode> and <icode type="element">sch:let</icode> are treated as <icode type="element">xsl:value-of</icode> and <icode type="element">xsl:variable</icode>. Also the <a ref="#sqf_keep"><icode type="element">sqf:keep</icode></a> element is available.</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:any processContents="skip"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>
    <xs:group name="activityElements">
        <xs:annotation>
            <xs:documentation>An activity element defines a change command for one or more nodes of the instance element. This change command is specified by the kind of activity element, the content and several attributes.</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:choice maxOccurs="unbounded" minOccurs="0">
                <xs:element ref="sqf:add"/>
                <xs:element ref="sqf:delete"/>
                <xs:element ref="sqf:replace"/>
                <xs:element ref="sqf:stringReplace"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>
    <xs:group name="fixElements">
        <xs:annotation>
            <xs:documentation>Elements to define QuickFixes or QuickFix groups inside of a Schematron schema.</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element ref="sqf:fix"/>
            <xs:element ref="sqf:group"/>
        </xs:choice>
    </xs:group>

    <xs:element name="fixes">
        <xs:annotation>
            <xs:documentation>Contains globally useable Schematron QuickFixes and QuickFix groups.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="sqf:fixElements"/>
            </xs:choice>
            <xs:attribute ref="xml:lang"/>
            <xs:attribute name="id" type="xs:ID"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="group">
        <xs:annotation>
            <xs:documentation>Defines a Schematron QuickFix group. If the group is linked by an assert or report, all QuickFixes of this group will be associated with the assert/report.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="sqf:fix"/>
            </xs:choice>
            <xs:attribute name="id" use="required" type="xs:string">
                <xs:annotation>
                    <xs:documentation>The ID to reference the QuickFix group.</xs:documentation>
                    <xs:documentation source="value">characters of type xs:ID. The value must be unique in the parent element.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="use-when" use="optional" type="xs:string" default="true()">
                <xs:annotation>
                    <xs:documentation>The condition to provide the QuickFixes of the QuickFix group.</xs:documentation>
                    <xs:documentation source="value">XPath expression. It expects as return value an xs:boolean.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute ref="xml:lang"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="fix">
        <xs:annotation>
            <xs:documentation>Defines a Schematron QuickFix with its content. All commands will be processed if the QuickFix is activated by the user.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="sqf:param" minOccurs="0" maxOccurs="unbounded"/>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:group ref="sqf:foreign"/>
                    <xs:element ref="sch:let"/>
                </xs:choice>
                <xs:element ref="sqf:description"/>
                <xs:group ref="sqf:foreign"/>
                <xs:choice>
                    <xs:sequence>
                        <xs:element ref="sqf:call-fix"/>
                    </xs:sequence>
                    <xs:sequence>
                        <xs:choice minOccurs="0" maxOccurs="unbounded">
                            <xs:element ref="sch:let"/>
                            <xs:element ref="sqf:user-entry"/>
                        </xs:choice>
                        <xs:group ref="sqf:activityElements"/>
                    </xs:sequence>
                </xs:choice>
            </xs:sequence>
            <xs:attribute name="id" use="required" type="xs:NCName">
                <xs:annotation>
                    <xs:documentation>The ID to reference the QuickFix.</xs:documentation>
                    <xs:documentation source="value">characters of type xs:ID. The value must be unique in the parent element.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="use-when" use="optional" type="xs:string" default="true()">
                <xs:annotation>
                    <xs:documentation>The condition to provide the QuickFix.</xs:documentation>
                    <xs:documentation source="value">XPath expression. It expects as return value an xs:boolean.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="role" use="optional">
                <xs:annotation>
                    <xs:documentation>With this attribute the role of the QuickFix can be set manually.</xs:documentation>
                    <xs:documentation>The role of a QuickFix describes the type of change which it makes. If the role is not set manually, the role is the type of the used activity element ("add", "delete", "replace" or "stringReplace"). If two different activity elements are used in a QuickFix, the role is automatically "mix".</xs:documentation>
                    <xs:documentation source="default">Depends on which activity element is used by the QuickFix.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="replace"/>
                        <xs:enumeration value="add"/>
                        <xs:enumeration value="stringReplace"/>
                        <xs:enumeration value="delete"/>
                        <xs:enumeration value="mix"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute ref="xml:lang"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="description">
        <xs:annotation>
            <xs:documentation>Adds a human readable description to the parent element.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="sqf:title"/>
                <xs:element ref="sqf:p" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute ref="xml:lang"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="user-entry">
        <xs:annotation>
            <xs:documentation>Defines a user entry. With the help of the user entry, the user can interact with the QuickFix. The user entry refers to a <icode type="element">sqf:param</icode> element. The value of the parameter is set manually by the user. The implementation should provide the user entry when the user selects the QuickFix.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="sqf:description"/>
            </xs:sequence>
            <xs:attributeGroup ref="sqf:parameterAttributes"/>
            <xs:attribute ref="xml:lang"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="call-fix">
        <xs:annotation>
            <xs:documentation>This element calls another QuickFix within a QuickFix. The called QuickFix must be defined globally or for the same Schematron rule as the calling QuickFix. A calling QuickFix should not have other activity elements.</xs:documentation>
            <xs:documentation>The calling QuickFix adopts the activity elements of the called QuickFix. With the help of parameters, these can be specified (see <a ref="#sqf_with-param"><icode type="element">sqf:with-param</icode></a>).</xs:documentation>
            <xs:documentation>The description and other characteristics (e.g. @use-when) of the called QuickFix will not be adopted.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="sqf:with-param" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="ref" use="required" type="xs:string">
                <xs:annotation>
                    <xs:documentation>This attribute refers to a QuickFix by using the ID. The referred QuickFix must be defined globally or for the same Schematron rule as the referring QuickFix.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="with-param">
        <xs:annotation>
            <xs:documentation>With the help of this element, QuickFix calls can be specified. A <icode type="element">sqf:with-param</icode> element refers to a parameter of the called QuickFix.</xs:documentation>
            <xs:documentation>The content or the <icode type="attribute">select</icode> attribute define the value of the parameter. If there is content, the <icode type="element">sqf:with-param</icode> element should not have a <icode type="attribute">select</icode> attribute.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:any processContents="lax"/>
            </xs:choice>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation source="Value">The name of the referred parameter.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="select" type="xs:string" use="optional">
                <xs:annotation>
                    <xs:documentation>This attribute defines with a XPath expression the value of the parameter. If the attribute is set, the <icode type="element">sqf:with-param</icode> element must be empty.</xs:documentation>
                    <xs:documentation source="Value">Must be a valid XPath expression.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="param">
        <xs:annotation>
            <xs:documentation>This element defines a parameter for a QuickFix. The parameter can be used like a variable within the QuickFix. The value can be set by the <a ref="#sqf_with-param"><icode type="element">sqf:with-param</icode></a> element.</xs:documentation>
            <xs:documentation>The content defines a default value for the parameter.</xs:documentation>
            <xs:documentation source="Exception">Abstract parameters (see attribute <icode type="attribute">abstract</icode>) cannot be used as normal XPath variables. An abstract parameter declares, that the current QuickFix uses a parameter of an abstract pattern. A QuickFix with one or more abstract parameters can be used just by abstract patterns. The value of the parameter will be set by the instantiation of the abstract pattern according to the Schematron specification. The instantiation of the abstract pattern must specify a value for every abstract parameter of the QuickFix.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:any processContents="lax"/>
            </xs:choice>
            <xs:attribute name="required" default="no">
                <xs:annotation>
                    <xs:documentation>This attribute sets for the parameter whether it is optional or required.</xs:documentation>
                    <xs:documentation>If the parameter is required, it cannot have a <icode type="attribute">default</icode> attribute or any content.</xs:documentation>
                    <xs:documentation source="Value">The value <icode type="attributeValue">yes</icode> is used for required, <icode type="attributeValue">no</icode> for optional.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="yes"/>
                        <xs:enumeration value="no"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="abstract" type="xs:boolean" default="false">
                <xs:annotation>
                    <xs:documentation>This attribute sets for the parameter whether it is abstract or not.</xs:documentation>

                    <xs:documentation>The current quick fix can be instantiate only from an abstract pattern that defines this abstract parameter. Inside of a global QuickFix every used parameter of an abstract pattern must be declared by an abstract parameter.</xs:documentation>
                    <xs:documentation>If a parameter is defined as abstract, it can not have a <icode type="attribute">type</icode>, <icode type="attribute">required</icode> or <icode type="attribute">default</icode> attribute. Its value will be only form the abstract pattern instantiation.</xs:documentation>
                    <xs:documentation source="Value">The value <icode type="attributeValue">true</icode> is used for abstract parameter, <icode type="attributeValue">false</icode> for regular parameter.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attributeGroup ref="sqf:parameterAttributes"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="title">
        <xs:annotation>
            <xs:documentation>Name of a QuickFix or a user entry.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="sch:foreign"/>
                <xs:choice>
                    <xs:element ref="sch:name"/>
                    <xs:element ref="sch:value-of"/>
                </xs:choice>
            </xs:choice>
            <xs:attribute ref="xml:lang"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="p">
        <xs:annotation>
            <xs:documentation>Paragraph within a description.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="sch:foreign"/>
                <xs:choice>
                    <xs:element ref="sch:name"/>
                    <xs:element ref="sch:value-of"/>
                    <xs:element ref="sch:emph"/>
                    <xs:element ref="sch:dir"/>
                    <xs:element ref="sch:span"/>
                </xs:choice>
            </xs:choice>
            <xs:attribute ref="xml:lang"/>
            <xs:attributeGroup ref="sch:foreign"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="replace">
        <xs:annotation>
            <xs:documentation>This activity element replaces one or more nodes of the XML instance by a node. The activity command combines the delete and the add command.</xs:documentation>
            <xs:documentation>The nodes to be deleted are defined by the <icode type="attribute">match</icode> attribute. The nodes to be added are defined by the attributes <icode type="attribute">node-type</icode> and <icode type="attribute">select</icode> and the content of the <icode type="element">sqf:replace</icode> element.</xs:documentation>
            <xs:documentation>The position of the nodes to be added is the position of the nodes to be deleted.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="sqf:templateElements"/>
            </xs:choice>
            <xs:attributeGroup ref="sqf:activityManipulate"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="delete">
        <xs:annotation>
            <xs:documentation>This activity element deletes one or more nodes of the XML instance.</xs:documentation>
            <xs:documentation>The <icode type="attribute">match</icode> attribute defines the nodes to be deleted.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attributeGroup ref="sqf:activityBase"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="add">
        <xs:annotation>
            <xs:documentation>This activity element adds a node to one or more nodes of the XML instance.</xs:documentation>
            <xs:documentation>The attributes <icode type="attribute">match</icode> and <icode type="attribute">position</icode> define the position where the nodes will be added. The position is determined by the anchor node(s) (<a ref="#activityBase_match">@match</a>) and the insertion direction (<a ref="#add_position">@position</a>).</xs:documentation>
            <xs:documentation>The attributes <icode type="attribute">node-type</icode>, <icode type="attribute">select</icode> and <icode type="attribute">target</icode> and the content of the element define the nodes to be added.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:group ref="sqf:templateElements"/>
            </xs:choice>
            <xs:attribute name="position" type="sqf:positionType">
                <xs:annotation>
                    <xs:documentation>The <icode type="attribute">position</icode> attribute defines the position of the nodes to be added relatively to the anchor node (see <a ref="#activityBase_match">@match</a>).</xs:documentation>
                    <xs:documentation source="Default">If the value of the <icode type="attribute">node-type</icode> attribute is <icode type="attributeValue">attribute</icode>, the <icode type="attribute">position</icode> attribute should not be set, because the node to be added will always be inserted as attribute. Otherwise the default value is <icode type="attributeValue">first-child</icode>.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attributeGroup ref="sqf:activityManipulate"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="stringReplace">
        <xs:annotation>
            <xs:documentation>This activity element replaces substrings of text nodes by other nodes. The text nodes are defined by the <icode type="attribute">match</icode> attribute. The <icode type="attribute">regex</icode> attribute defines the substrings of the text nodes.</xs:documentation>
            <xs:documentation>The nodes to be inserted are defined by the content of the <icode type="element">sqf:stringReplace</icode> element or the <icode type="attribute">select</icode> attribute. <b>Note:</b> The context within the <icode type="element">sqf:stringReplace</icode> element is set to the substrings. So, it is an atomic value.</xs:documentation>
        </xs:annotation>
        <xs:complexType mixed="true">
            <xs:choice>
                <xs:group ref="sqf:templateElements"/>
            </xs:choice>
            <xs:attributeGroup ref="sqf:activityBase"/>
            <xs:attribute name="regex" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation source="Value">Regular expression. The expression can be specified by XPath expressions which are marked by curly brackets. After processing, the regular expression must meet the requirements of the <icode type="attribute">regex</icode> attribute of the <icode type="element">xsl:analyze-string</icode> element.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="select" type="xs:string">
                <xs:annotation>
                    <xs:documentation>The <icode type="attribute">select</icode> attribute defines nodes or an atomic value as the nodes to be inserted. If the <icode type="attribute">select</icode> attribute is set, the <icode type="attribute">sqf:stringReplace</icode> element should be empty.</xs:documentation>
                    <xs:documentation>The selected nodes will be copied. Unlike a deep copy function, the copied nodes could be manipulated by the current or other activity elements.</xs:documentation>
                    <xs:documentation source="Value">XPath expression. The context of relative expressions is the substring to replace. </xs:documentation>
                    <xs:documentation><b>Note:</b> The context will be always an atomic value. To select nodes from the XML instance, the use of variables outside of the <icode type="element">sqf:stringReplace</icode> element is necessary.</xs:documentation>
                    <xs:documentation source="Default">There is no default value. If the <icode type="attribute">select</icode> attribute is not set, the content of the activity element defines the nodes to be inserted.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:attributeGroup name="activityBase">
        <xs:attribute name="match" type="xs:string" default=".">
            <xs:annotation>
                <xs:documentation>The <icode type="attribute">match</icode> attribute defines anchor nodes for an activity element.</xs:documentation>
                <xs:documentation>For each selected anchor node, the command of the activity element will be executed. For each execution, the context will be set to the anchor node.</xs:documentation>
                <xs:documentation>Exception: The <icode type="attribute">match</icode> attribute of the <a ref="#sqf_stringReplace"><icode type="element">sqf:stringReplace</icode></a> element should only select text nodes.</xs:documentation>
                <xs:documentation source="Value">XPath expression. The context of relative expressions is the context of the related Schematron rule.</xs:documentation>
                <xs:documentation source="Default">By default the anchor node is the context node of the related Schematron rule.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="use-when" use="optional" type="xs:string" default="true()">
            <xs:annotation>
                <xs:documentation>A condition for the action of the activity Element. The action will just be executed, if the condition returns true.</xs:documentation>
                <xs:documentation source="value">XPath expression. It expects as return value an xs:boolean.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attributeGroup ref="sch:foreign"/>
    </xs:attributeGroup>
    <xs:attributeGroup name="activityManipulate">
        <xs:attributeGroup ref="sqf:activityBase"/>
        <xs:attribute name="node-type" type="sqf:nodeTypeType">
            <xs:annotation>
                <xs:documentation>The <icode type="attribute">node-type</icode> attribute defines the node type of the nodes to be added. The attribute is required, if the target attribute is set.</xs:documentation>
                <xs:documentation>If the <icode type="attribute">node-type</icode> value is missing, the activity element should not have a <icode type="attribute">target</icode> attribute. In this case the nodes to be added will be defined by the activity elements content or <icode type="attribute">select</icode> attribute.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="select" type="xs:string" use="optional">
            <xs:annotation>
                <xs:documentation>The <icode type="attribute">select</icode> attribute defines nodes or an atomic value as the content of the node to be added. If the <icode type="attribute">select</icode> attribute is set, the activity element should be empty.</xs:documentation>
                <xs:documentation>The selected nodes will be copied into the node to be added. Unlike a deep copy function, the copied nodes could be manipulated by the current or other activity elements.</xs:documentation>
                <xs:documentation source="Value">XPath expression. The context of relative expressions is the anchor node.</xs:documentation>
                <xs:documentation source="Default">There is no default value. If the <icode type="attribute">select</icode> attribute is not set, the content of the activity element defines the content of the nodes to be added.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="target" type="xs:string">
            <xs:annotation>
                <xs:documentation>This attribute defines the name of the node to be added. The attribute is required if the <icode type="attribute">node-type</icode> attribute is specified and the value is not <icode type="attributeValue">comment</icode>.</xs:documentation>
                <xs:documentation source="Value">A string to define a node name. The string can be specified by XPath expressions which are marked by curly brackets. After processing, the name must be valid to the XML Schema type xs:QName.</xs:documentation>
                <xs:documentation>Prefixes must be attached to a namespace in the current context of the Schematron schema. Names without prefixes will be attached to the namespace declared by the <icode type="element">sqf:default-namespace</icode> element or to the null namespace.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>



    <xs:simpleType name="positionType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="after">
                <xs:annotation>
                    <xs:documentation>The nodes to be added will be inserted after the anchor node.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="before">
                <xs:annotation>
                    <xs:documentation>The nodes to be added will be inserted before the anchor node.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="first-child">
                <xs:annotation>
                    <xs:documentation>The nodes to be added will be inserted as the first child of the anchor node.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="last-child">
                <xs:annotation>
                    <xs:documentation>The nodes to be added will be inserted as the last child of the anchor node.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="nodeTypeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="keep">
                <xs:annotation>
                    <xs:documentation>The node type of the node to be added will be defined by the anchor node.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="element">
                <xs:annotation>
                    <xs:documentation>The node to be added will be an element.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="attribute">
                <xs:annotation>
                    <xs:documentation>The node to be added will be an attribute. The <icode type="attribute">position</icode> attribute should not be set.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="processing-instruction">
                <xs:annotation>
                    <xs:documentation>The node to be added will be a processing instruction.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="pi">
                <xs:annotation>
                    <xs:documentation>The short notation of "processing-instruction".</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="comment">
                <xs:annotation>
                    <xs:documentation>The node to be added will be a comment. If the value of the <icode type="attribute">node-type</icode> attribute is <icode type="attributeValue">comment</icode>, the activity element should not have a <icode type="attribute">target</icode> attribute.</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="keep">
        <xs:annotation>
            <xs:documentation>This element is available within activity elements. The function is to copy nodes selected by the <icode type="attribute">select</icode> attribute. Unlike a deep copy function, with this function the copied nodes can be manipulated by the current or other activity elements.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="select" type="xs:string" default="node()">
                <xs:annotation>
                    <xs:documentation>The attribute selects nodes to be copied.</xs:documentation>
                    <xs:documentation source="Value">XPath expression.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:group name="foreign">
        <xs:sequence>
            <xs:group minOccurs="0" maxOccurs="unbounded" ref="sqf:foreign-element"/>
        </xs:sequence>
    </xs:group>

    <xs:group name="foreign-element">
        <xs:choice>
            <xs:any namespace="http://www.w3.org/1999/XSL/Transform" processContents="skip"/>
            <xs:any namespace="##local" processContents="skip"/>
        </xs:choice>
    </xs:group>
</xs:schema>