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

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

Parent elements

Child elements

Attributes

See attribute group sqf:activityManipulate.

Content model

Oxygen Content Model

Dynamic Content Model

Content model replace

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

Parent elements

Child elements

Attributes

@flags

Use

optional

Value

xs:string

Flags to control the interpretation of the regular expression (given in the regex attribute). The flags can be specified by XPath expressions which are marked by curly brackets. After processing, the flags must meet the requirements of the flags attribute of the <xsl:analyze-string> element.

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

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

See attribute group sqf:activityBase.

Content model

Oxygen Content Model

Dynamic Content Model

Content model stringReplace

<sqf:title>

Name of a QuickFix or a user entry.

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 title

<sqf:user-entry>

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

Parent elements

Child elements

Attributes

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

Content model

Oxygen Content Model

Dynamic Content Model

Content model user-entry

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

Parent elements

Attributes

@name

Use

required

Value

xs:string

The name of the referred parameter.

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

See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model with-param

Element groups

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.

Used by

Content model

Oxygen Content Model

Dynamic Content Model

Content model activityElements

sqf:fixElements

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

Used by

Content model

Oxygen Content Model

Dynamic Content Model

Content model fixElements

sqf:foreign

Used by

Content model

Oxygen Content Model

Dynamic Content Model

Content model foreign

sqf:foreign-element

Used by

Content model

Oxygen Content Model

Dynamic Content Model

Content model foreign-element

sqf:templateElements

This element group describes the content of the activity elements. The behavior 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:copy-of> element is available.

Content model

Oxygen Content Model

Dynamic Content Model

Content model templateElements

Attribute groups

activityBase

Attributes

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

@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

See attribute group sch:foreign.

Content model

Oxygen Content Model

Dynamic Content Model

Content model activityBase

activityManipulate

Attributes

@node-type

Description

The node-type attribute defines the node type of the nodes to be added. The attribute is required, if the target attribute 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.

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

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

See attribute group sqf:activityBase.

Content model

Oxygen Content Model

Dynamic Content Model

Content model activityManipulate

messageAttributes

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

Attributes

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

@fix

Description

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.

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.

Content model

Oxygen Content Model

Dynamic Content Model

Content model messageAttributes

parameterAttributes

Attributes

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

@name

Description

This attribute defines the name of the parameter or User Entry.

Use

required

Value

xs:string

Must be unique within a QuickFix.

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

Content model

Oxygen Content Model

Dynamic Content Model

Content model parameterAttributes

refAttribute

Attributes

@ref

Description

References to alternative text phrases (e.g. for localisation).

A minimum implementation for this attribute should support a reference to an ID of a sch:diagnostic element. Alternativly an implementation is free to support references to other localisation files (e.g. Java properties files). A reference token which does not reference to a known target should not occure an error but should be ignored.

Use

optional

Value

xs:NMTOKENS

A whitespace separated list of tokens which represents a reference.

Content model

Oxygen Content Model

Dynamic Content Model

Content model refAttribute

rootAttributes

Attributes

@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

Content model

Oxygen Content Model

Dynamic Content Model

Content model rootAttributes

© Copyright 2014-2018 Nico Kutscherauer (last update 2018-07-17)

ImprintPrivacy PolicyContactSitemap