Schematron QuickFix reference

Oxygen Content Model

Dynamic Content Model

Global declarations

In this documentation the following expressions will be used. The table bellow shows the definitions of these expressions:

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.

Global QuickFix

A QuickFix which is defined in the top-level <sqf:fixes> element. A global QuickFix is available in each Schematron rule.

Local QuickFix

A QuickFix which is defined for a Schematron rule. It is only available in this Schematron rule.

Execute a QuickFix

All activity elements which the QuickFix contains will be performed.

Activity element

implements a change command.

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".

Add change command

creates one or more nodes and adds them relatively to an anchor node to the XML instance.

Delete change command

deletes one or more nodes.

Replace change command

creates one or more nodes and replaces nodes of the XML instance with them.

String replace change command

creates one or more nodes and replaces substrings of a text node of the XML instance with them.

Anchor node

context node of an activity element. The node is the subject of the change command of the activity element.

Elements

<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.

Parent elements

Child elements

Attributes

@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.

See attribute group sqf:activityManipulate.

Content model

Oxygen Content Model

Dynamic Content Model

Content model add

<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.

Parent elements

Child elements

Attributes

@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

See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model call-fix

<sqf:copy-of>

This element is available within activity elements. The function is to copy nodes selected by the select attribute. The element with its attribute is treated as <xsl:copy-of> with select attribute as it is defined in the XSLT requirement.

Attributes

@select

Description

The attribute selects nodes to be copied.

Use

optional

Default

node()

Value

xs:string

XPath expression.

Content model

Oxygen Content Model

Dynamic Content Model

Content model copy-of

<sqf:delete>

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

The match attribute defines the nodes to be deleted.

Parent elements

Attributes

See attribute group sqf:activityBase.

Content model

Oxygen Content Model

Dynamic Content Model

Content model delete

<sqf:description>

Adds a human readable description to the parent element.

Parent elements

Child elements

Attributes

@xml:lang (optional)
See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model description

<sqf:fix>

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

Parent elements

Attributes

@id

Description

The ID to reference the QuickFix.

Use

required

Value

xs:NCName

@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

@use-for-each

Description

QuickFixes with use-for-each attribute are generic. Each return value of the evaluated XPath expression should create an own QuickFix. To access to the current return value, the XPath variable $sqf:current should be provided.

Use

optional

Default

.

Value

xs:string

@use-when

Description

The condition to provide the QuickFix.

Use

optional

Default

true()

Value

xs:string

@xml:lang (optional)
See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model fix

<sqf:fixes>

Contains globally useable Schematron QuickFixes and QuickFix groups.

Child elements

Attributes

@id

Use

optional

Value

xs:ID

@xml:lang (optional)
See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model fixes

<sqf:group>

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.

Parent elements

Child elements

Attributes

@id

Description

The ID to reference the QuickFix group.

Use

required

Value

xs:string

@use-when

Description

The condition to provide the QuickFixes of the QuickFix group.

Use

optional

Default

true()

Value

xs:string

@xml:lang (optional)
See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model group

<sqf:p>

Paragraph within a description.

Parent elements

Child elements

Attributes

@xml:lang (optional)
See attribute group sch:foreign.
See attribute group sqf:refAttribute.

Content model

Oxygen Content Model

Dynamic Content Model

Content model p

<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.

Exception

Abstract parameters (see attribute abstract) 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.

Parent elements

Attributes

@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.

@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.

See attribute group sch:foreign.
See attribute group sqf:parameterAttributes.

Content model

Oxygen Content Model

Dynamic Content Model

Content model param