<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- Documenting T:NAnt.Core.Filters.ReplaceTokens--> <head> <meta http-equiv="Content-Language" content="en-ca" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="../style.css" /> <title><replacetokens> Filter</title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar"> <tr> <td class="NavBar-Cell"> <a href="http://nant.sourceforge.net"> <b>NAnt</b> </a> <img alt="->" src="../images/arrow.gif" /> <a href="../index.html">Help</a> <img alt="->" src="../images/arrow.gif" /> <a href="../filters/index.html">Filter Reference</a> <img alt="->" src="../images/arrow.gif" /> <replacetokens></td> <td class="NavBar-Cell" align="right"> v0.90</td> </tr> </table> <h1><replacetokens></h1> <p> Replaces tokens in the original input with user-supplied values. </p> <p> This filter replaces all token surrounded by a beginning and ending token. The default beginning and ending tokens both default to '@'. The optional <code>begintoken</code> and <code>endtoken</code> attributes can be specified to change either token. By default string comparisons are case sensitive but this can be changed by setting the optional <code>ignorecase</code> attribute to <b>true</b>. </p> <p> Tokens are specified by using the <a href="../elements/NAnt.Core.Types.Token.html">Token</a> element. It is possible to specify from 1 to n tokens and replacement values. Values can be any valid NAnt expression. </p> <p> Filters are intended to be used as a element of a <a href="../types/filterchain.html"><filterchain></a>. </p> <h3>Parameters</h3> <div class="table"> <table> <tr> <th>Attribute</th> <th style="text-align: center;">Type</th> <th>Description</th> <th style="text-align: center;">Required</th> </tr> <tr> <td valign="top">begintoken</td> <td style="text-align: center;">char</td> <td> Marks the beginning of a token. The default is "@". </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">endtoken</td> <td style="text-align: center;">char</td> <td> Marks the end of a token. The default is "@". </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">ignorecase</td> <td style="text-align: center;">bool</td> <td> Determines if case will be ignored. The default is <b>false</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">if</td> <td style="text-align: center;">bool</td> <td> If <b>true</b> then the filter will be used; otherwise, skipped. The default is <b>true</b>. </td> <td style="text-align: center;">False</td> </tr> <tr> <td valign="top">unless</td> <td style="text-align: center;">bool</td> <td> Opposite of <code>if</code>. If <b>false</b> then the filter will be executed; otherwise, skipped. The default is <b>false</b>. </td> <td style="text-align: center;">False</td> </tr> </table> </div> <h3>Nested Elements:</h3> <!--Array--> <!--NestedElementArray=T:NAnt.Core.Types.Token--> <h4> <a id="token"> </a> <token> </h4> <div class="nested-element"> Tokens and replacement values. <p> ReplaceTokens filter token. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">key</td><td style="text-align: center;">string</td><td> Token to be replaced. </td><td style="text-align: center;">True</td></tr><tr><td valign="top" class="required">value</td><td style="text-align: center;">string</td><td> New value of token. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> Indicates if the token should be used to replace values. If <b>true</b> then the token will be used; otherwise, not. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Indicates if the token should not be used to replace values. If <b>false</b> then the token will be used; otherwise, not. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div> <h4> <a id="token"> </a> </token> </h4> <h3>Examples</h3> <ul class="examples"> <li> <p> Replace all occurrences of the string @DATE@ with the value of property "TODAY". </p> <pre class="code"> <replacetokens> <token key="DATE" value="${TODAY}" /> </replacetokens> </pre> </li> <li> <p> Replace all occurrences of the string <DATE> with the value of property "TODAY". </p> <pre class="code"> <replacetokens begintoken="&lt;" endtoken="&gt;"> <token key="DATE" value="${TODAY}" /> </replacetokens> </pre> </li> </ul> <h3>Requirements</h3> <div style="margin-left: 20px;"> <b>Assembly:</b> NAnt.Core (0.90.3780.0) </div> </body> </html>