The Append Task appends text or contents of files to a specified file.
In the example above, AppendTask is reading a filename from book/PhingGuide.book
, processing
the file contents with XSLT, and then appending the result to the file located at
${process.outputfile}
. This is a real example from the build file used to generate this book!
By default, whitespace is stripped from text that is appended to a file (matching the way the Concat task works in Ant).
This is because adding a nested text element may introduce additional (ignorable) whitespace. If you want to override this behavior,
set the skipsanitize
attribute to true
.
Table B.3: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
destFile
|
File
| Path of file to which text should be appended. If not specified the console will be used instead. | n/a | No |
append
|
String
| Specifies whether or not the file specified by 'destfile' should be appended. Defaults to "yes". | yes | No |
overwrite
|
Boolean
| Specifies whether or not the file specified by 'destfile' should be written to even if it is newer than all source files. | yes | No |
fixlastline
|
Boolean
| Specifies whether or not to check if each file concatenated is terminated by a new line. If this attribute is "yes" a new line will be appended to the stream if the file did not end in a new line. This attribute does not apply to embedded text. | no | No |
eol
|
String
|
Specifies what the end of line character are for use by the fixlastline attribute.
Valid values for this property are:
| n/a | No |
skipsanitize
|
Boolean
| Specifies whether to skip sanitizing text (i.e., stripping spaces and newlines). | n/a | No |
file
|
File
| Path to file that should be appended to destFile. | n/a | No |
text
|
String
| Some literal text to append to file. | n/a | No |
<append destFile="${process.outputfile}"> <filterchain> <xsltfilter style="${process.stylesheet}"> <param name="mode" expression="${process.xslt.mode}"/> </xsltfilter> </filterchain> <filelist dir="book/" listfile="book/PhingGuide.book"/> </append>
path
header, footer
Used to prepend or postpend text into the concatenated stream.
The text may be in-line or be in a file.
Table B.4: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
filtering
|
Boolean
| Whether to filter the text provided by this sub element. | yes | No |
file
|
String
| A file to place at the head or tail of the concatenated text. | n/a | No |
trim
|
Boolean
| Whether to trim the value. | no | No |
trimleading
|
Boolean
| Whether to trim leading white space on each line. | no | No |