# <filterchain>

Represent a chain of NAnt filters that can be applied to a Task.

A FilterChain represents a collection of one or more filters that can be appled to a Task such as the <copy> task. In the case of the <copy> task, the contents of the copied files are filtered through each filter specified in the filter chain. Filtering occurs in the order the filters are specified with filtered output of one filter feeding into another.

:--------:--->:----------:--->:----------: ... :----------:--->:--------:
:.Source.:--->:.Filter 1.:--->:.Filter 2.: ... :.Filter n.:--->:.target.:
:--------:--->:----------:--->:----------: ... :----------:--->:--------:

A list of all filters that come with NAnt is available here.

The following tasks support filtering with a FilterChain:

- <copy> task
- <move> task

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
encoding | Encoding | Deprecated. The encoding to assume when filter-copying files. The default is system's current ANSI code page. | False
id | string | The ID used to be referenced later. | False
refid | string | The ID to use as the reference. | False

### Nested Elements:

#### <filter>

The filters to apply.

Allows a file's content to be modified while performing an operation.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
if | bool | If true then the filter will be used; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the filter will be executed; otherwise, skipped. The default is false. | False

#### </filter>

### Examples

- Replace all occurrences of @NOW@ with the current date/time and replace tabs with spaces in all copied files.

      <property name="NOW" value="${datetime::now()}" />
      <copy todir="out">
          <fileset basedir="in">
              <include name="**/*" />
          </fileset>
          <filterchain>
              <replacetokens>
                  <token key="NOW" value="${TODAY}" />
              </replacetokens>
              <tabstospaces />
          </filterchain>
      </copy>

### Requirements

Assembly: NAnt.Core (0.92.4543.0)