IfField

The <IfField> element makes operations conditional on the presence of a metadata field.

Using <IfField> does not change the context (the current position in the document).

Attribute Description
name The name of an existing field.
nameRegex A regular expression to match the name of one or more existing fields.
path The path of an existing field.
pathRegex A regular expression to match the path of one or more existing fields.
negate Set this attribute to true to perform the child operations only when there are no matching fields.

The following attributes filter the matching fields by their values:

Attribute Description
containsRegex The field value must contain a match to this regular expression.
matches The field value must match this value exactly.
matchesRegex The whole field value must match this regular expression.
matchType

Specifies the conditions necessary for the child operations to be performed:

  • all - all fields selected by name or path must have the specified value.
  • any - one or more of the fields selected by name or path must have the specified value.
  • none - none of fields selected by name or path must have the specified value.

In the following example, the field "anotherField" is deleted, but only if the document contains a field named "myField" with the value "ERROR". The <IfField> element does not change the context, so "anotherField" is deleted from the root of the document (it is not a subfield of "myField").

<FieldStandardization>
    <IfField name="myField" matches="ERROR">
         <Field name="anotherField">
             <Delete/>
         </Field>
    </IfField>
</FieldStandardization>