| 182 | | <h2><a name="CoreFilters"></a>Core Filters</h2> |
|---|
| 183 | | |
|---|
| 184 | | <p>Filters have to be defined within a <em><filterchain></em> |
|---|
| 185 | | context to work. Example:</p> |
|---|
| 186 | | <pre> |
|---|
| 187 | | <filterchain> |
|---|
| 188 | | <expandproperties /> |
|---|
| 189 | | </filterchain> |
|---|
| 190 | | </pre> |
|---|
| 191 | | <p> There are two ways to use a filter: System filters (the ones shipped with |
|---|
| 192 | | Phing) can be used with their own tag name, such as <em><xsltfilter</em>>, |
|---|
| 193 | | <<em>expandpropertyfilter</em>> or <em><tabtospaces</em>>. Another |
|---|
| 194 | | way is to use the <em><filterreader></em> tag. </p> |
|---|
| 195 | | |
|---|
| 196 | | <h2><a name="PhingFilterReader"></a>PhingFilterReader</h2> |
|---|
| 197 | | <p> The PhingFilterReader is used when you want to use filters that are not directly |
|---|
| 198 | | available through their own tag. Example: </p> |
|---|
| 199 | | <pre> |
|---|
| 200 | | <filterchain> |
|---|
| 201 | | <filterreader classname="phing.filter.ReplaceTokens"> |
|---|
| 202 | | <-- other way to set attributes --> |
|---|
| 203 | | <param name="begintoken" value="@@" /> |
|---|
| 204 | | <param name="endtoken" value="@@" /> |
|---|
| 205 | | |
|---|
| 206 | | <-- other way to set nested tags --> |
|---|
| 207 | | <param type="token" key="bar" value="foo" /> |
|---|
| 208 | | </filterreader> |
|---|
| 209 | | </filterchain> |
|---|
| 210 | | </pre> |
|---|
| 211 | | <p> In the <em>filterreader</em> tag you have to specify the path the class is |
|---|
| 212 | | in. The <em>FilterReader</em> will then load this class and pass the parameters |
|---|
| 213 | | to the loaded filter. There are two types of parameters: First, you can pass |
|---|
| 214 | | "normal" parameters to the loaded filter. That means, you can pass |
|---|
| 215 | | parameters as if they were attributes. If you want to do this, you only specify |
|---|
| 216 | | the <em>name</em> and <em>value</em> attributes in the <em>param</em> tag. You |
|---|
| 217 | | can also pass nested elements to the filter. Then, you have to specify the <em>type</em> |
|---|
| 218 | | attribute. This attribute specifies the name of the nested tag. </p> |
|---|
| 219 | | <p>The result of the example above is identical with the following code: </p> |
|---|
| 220 | | <pre> |
|---|
| 221 | | <filterchain> |
|---|
| 222 | | <replacetokens begintoken="@@" endtoken="@@"> |
|---|
| 223 | | <token key="bar" value="foo" /> |
|---|
| 224 | | </replacetokens> |
|---|
| 225 | | </filterchain></pre> |
|---|
| 226 | | <h3>Attributes</h3> |
|---|
| 227 | | <table> |
|---|
| 228 | | <caption> |
|---|
| 229 | | Attributes for <em><filterreader></em> |
|---|
| 230 | | </caption> |
|---|
| 231 | | <thead> |
|---|
| 232 | | <tr> |
|---|
| 233 | | <th>Name</th> |
|---|
| 234 | | <th>Type</th> |
|---|
| 235 | | <th>Description</th> |
|---|
| 236 | | <th>Default</th> |
|---|
| 237 | | <th>Required</th> |
|---|
| 238 | | </tr> |
|---|
| 239 | | </thead> |
|---|
| 240 | | <tbody> |
|---|
| 241 | | <tr> |
|---|
| 242 | | <td>classname</td> |
|---|
| 243 | | <td>String</td> |
|---|
| 244 | | <td> Name of class to use (in dot-path notation).</td> |
|---|
| 245 | | <td>n/a</td> |
|---|
| 246 | | <td>Yes</td> |
|---|
| 247 | | </tr> |
|---|
| 248 | | <tr> |
|---|
| 249 | | <td>classpath</td> |
|---|
| 250 | | <td>String</td> |
|---|
| 251 | | <td> The classpath to use when including classes. This is added to PHP's |
|---|
| 252 | | include_path.</td> |
|---|
| 253 | | <td>n/a</td> |
|---|
| 254 | | <td>No</td> |
|---|
| 255 | | </tr> |
|---|
| 256 | | <tr> |
|---|
| 257 | | <td>classpathref</td> |
|---|
| 258 | | <td>String</td> |
|---|
| 259 | | <td> Reference to classpath to use when including classes. This is added |
|---|
| 260 | | to PHP's include_path.</td> |
|---|
| 261 | | <td>n/a</td> |
|---|
| 262 | | <td>No</td> |
|---|
| 263 | | </tr> |
|---|
| 264 | | </tbody> |
|---|
| 265 | | </table> |
|---|
| 266 | | <h3>Nested Tags</h3> |
|---|
| 267 | | <p> The <em>PhingFilterReader</em> supports nested <classpath>.</p> |
|---|
| 268 | | <h3>Advanced</h3> |
|---|
| 269 | | <p>In order to support the <filterreader ... /> sytax, your class must |
|---|
| 270 | | extend the BaseParamFilterReader class. Most of the filters that are bundled |
|---|
| 271 | | with Phing can be invoked using this syntax. The noteable exception (at time of |
|---|
| 272 | | writing) is the ReplaceRegexp filter, which expects find/replace parameters that do not fit the |
|---|
| 273 | | name/value mold. For this reason, you must always use the shorthand <replaceregexp .../> to invoke |
|---|
| 274 | | this filter.</p> |
|---|
| 275 | | |
|---|
| 276 | | <h2><a name="ExpandProperties"></a>ExpandProperties</h2> |
|---|
| 277 | | <p> |
|---|
| 278 | | The ExpandProperties simply replaces property names with their |
|---|
| 279 | | property values. For example, if you have the following in your |
|---|
| 280 | | build file: |
|---|
| 281 | | </p> |
|---|
| 282 | | <pre> |
|---|
| 283 | | <property name="description.txt" value="This is a text file" /> |
|---|
| 284 | | |
|---|
| 285 | | <copy todir="/tmp"> |
|---|
| 286 | | <filterchain> |
|---|
| 287 | | <expandproperties /> |
|---|
| 288 | | </filterchain> |
|---|
| 289 | | |
|---|
| 290 | | <fileset dir="."> |
|---|
| 291 | | <include name="**" /> |
|---|
| 292 | | </fileset> |
|---|
| 293 | | </copy> |
|---|
| 294 | | </pre> |
|---|
| 295 | | <p> |
|---|
| 296 | | And the string <em>${description.txt}</em> it will be replaced by |
|---|
| 297 | | <em>This is a text file</em>. |
|---|
| 298 | | </p> |
|---|
| 299 | | |
|---|
| 300 | | <h2><a name="HeadFilter"></a>HeadFilter</h2> |
|---|
| 301 | | <p> |
|---|
| 302 | | This filter reads the first <em>n</em> lines of a file; the others |
|---|
| 303 | | are not further passed through the filter chain. Usage example: |
|---|
| 304 | | </p> |
|---|
| 305 | | <pre> |
|---|
| 306 | | <filterchain> |
|---|
| 307 | | <headfilter lines="20" /> |
|---|
| 308 | | </filterchain> |
|---|
| 309 | | </pre> |
|---|
| 310 | | <h3>Attributes</h3> |
|---|
| 311 | | <table> |
|---|
| 312 | | <caption> |
|---|
| 313 | | Attributes for the <em><headfilter> </em>tag |
|---|
| 314 | | </caption> |
|---|
| 315 | | <thead> |
|---|
| 316 | | <tr> |
|---|
| 317 | | <th>Name</th> |
|---|
| 318 | | <th>Type</th> |
|---|
| 319 | | <th>Description</th> |
|---|
| 320 | | <th>Default</th> |
|---|
| 321 | | <th>Required</th> |
|---|
| 322 | | </tr> |
|---|
| 323 | | </thead> |
|---|
| 324 | | <tbody> |
|---|
| 325 | | <tr> |
|---|
| 326 | | <td>lines</td> |
|---|
| 327 | | <td>Integer</td> |
|---|
| 328 | | <td> |
|---|
| 329 | | Number of lines to read. |
|---|
| 330 | | </td> |
|---|
| 331 | | <td>10</td> |
|---|
| 332 | | <td>No</td> |
|---|
| 333 | | </tr> |
|---|
| 334 | | </tbody> |
|---|
| 335 | | </table> |
|---|
| 336 | | |
|---|
| 337 | | <h2><a name="LineContains"></a>Line Contains</h2> |
|---|
| 338 | | <p> |
|---|
| 339 | | This filter is only "permeable" for lines that contain |
|---|
| 340 | | the expression given as parameter. For example, the following |
|---|
| 341 | | filterchain would only let all the lines pass that contain |
|---|
| 342 | | <em>class</em>: |
|---|
| 343 | | </p> |
|---|
| 344 | | <pre> |
|---|
| 345 | | <filterchain> |
|---|
| 346 | | <linecontains> |
|---|
| 347 | | <contains value="class" /> |
|---|
| 348 | | </linecontains> |
|---|
| 349 | | </filterchain> |
|---|
| 350 | | </pre> |
|---|
| 351 | | |
|---|
| 352 | | <h3>Nested Tags</h3> |
|---|
| 353 | | |
|---|
| 354 | | <p> |
|---|
| 355 | | The <em>linecontains</em> tag must contain one or more <em>contains</em> |
|---|
| 356 | | tags. Latter must have a <em>value</em> attribute that has to be set |
|---|
| 357 | | to the string the line has to contain to be let through. |
|---|
| 358 | | </p> |
|---|
| 359 | | |
|---|
| 360 | | <h2><a name="LineContainsRegexp"></a>LineContainsRegexp</h2> |
|---|
| 361 | | <p> |
|---|
| 362 | | This filter is similar to <a href="#LineContains">LineContains</a> |
|---|
| 363 | | but you can specify regular expressions instead of simple strings. |
|---|
| 364 | | </p> |
|---|
| 365 | | <pre> |
|---|
| 366 | | <filterchain> |
|---|
| 367 | | <linecontainsregexp> |
|---|
| 368 | | <regexp pattern="foo(.*)bar" /> |
|---|
| 369 | | </linecontainsregexp> |
|---|
| 370 | | </filterchain> |
|---|
| 371 | | </pre> |
|---|
| 372 | | |
|---|
| 373 | | <h3>Nested Tags</h3> |
|---|
| 374 | | |
|---|
| 375 | | <p> |
|---|
| 376 | | The <em>LineContains</em> filter has to contain at least one <em>regexp</em> |
|---|
| 377 | | tag. This must have a <em>pattern</em> attribute that is set to a |
|---|
| 378 | | regular expression. |
|---|
| 379 | | </p> |
|---|
| 380 | | |
|---|
| 381 | | <h2><a name="PrefixLines"></a>PrefixLines</h2> |
|---|
| 382 | | <p> |
|---|
| 383 | | This filter adds a prefix to every line. The following example will add |
|---|
| 384 | | the string <em>foo: </em> in front of every line. |
|---|
| 385 | | </p> |
|---|
| 386 | | <pre> |
|---|
| 387 | | <filterchain> |
|---|
| 388 | | <prefixlines prefix="foo: " /> |
|---|
| 389 | | </filterchain> |
|---|
| 390 | | </pre> |
|---|
| 391 | | <h3>Attributes</h3> |
|---|
| 392 | | <table> |
|---|
| 393 | | <caption> |
|---|
| 394 | | Attributes for the <em><prefixlines></em> tag |
|---|
| 395 | | </caption> |
|---|
| 396 | | <thead> |
|---|
| 397 | | <tr> |
|---|
| 398 | | <th>Name</th> |
|---|
| 399 | | <th>Type</th> |
|---|
| 400 | | <th>Description</th> |
|---|
| 401 | | <th>Default</th> |
|---|
| 402 | | <th>Required</th> |
|---|
| 403 | | </tr> |
|---|
| 404 | | </thead> |
|---|
| 405 | | <tbody> |
|---|
| 406 | | <tr> |
|---|
| 407 | | <td>prefix</td> |
|---|
| 408 | | <td>string</td> |
|---|
| 409 | | <td> |
|---|
| 410 | | Strint to prepend to every line. |
|---|
| 411 | | </td> |
|---|
| 412 | | <td>n/a</td> |
|---|
| 413 | | <td>Yes</td> |
|---|
| 414 | | </tr> |
|---|
| 415 | | </tbody> |
|---|
| 416 | | </table> |
|---|
| 417 | | |
|---|
| 418 | | <h2><a name="ReplaceTokens"></a>ReplaceTokens</h2> |
|---|
| 419 | | <p> |
|---|
| 420 | | The <em>ReplaceTokens</em> filter will replace certain tokens. Tokens |
|---|
| 421 | | are strings enclosed in special characters. If you want to replace |
|---|
| 422 | | <em>##BCHOME##</em> by the path to the directory set in the |
|---|
| 423 | | environment variable <em>BCHOME</em>, you could do the following: |
|---|
| 424 | | </p> |
|---|
| 425 | | <pre> |
|---|
| 426 | | <property environment="env" /> |
|---|
| 427 | | |
|---|
| 428 | | <filterchain> |
|---|
| 429 | | <replacetokens begintoken="##" endtoken="##"> |
|---|
| 430 | | <token key="BCHOME" value="${env.BCHOME}" /> |
|---|
| 431 | | </replacetokens> |
|---|
| 432 | | </filterchain> |
|---|
| 433 | | </pre> |
|---|
| 434 | | <h3>Attributes</h3> |
|---|
| 435 | | <table> |
|---|
| 436 | | <caption> |
|---|
| 437 | | Attributes for the <em><replacetokens></em> tag |
|---|
| 438 | | </caption> |
|---|
| 439 | | <thead> |
|---|
| 440 | | <tr> |
|---|
| 441 | | <th>Name</th> |
|---|
| 442 | | <th>Type</th> |
|---|
| 443 | | <th>Description</th> |
|---|
| 444 | | <th>Default</th> |
|---|
| 445 | | <th>Required</th> |
|---|
| 446 | | </tr> |
|---|
| 447 | | </thead> |
|---|
| 448 | | <tbody> |
|---|
| 449 | | <tr> |
|---|
| 450 | | <td>begintoken</td> |
|---|
| 451 | | <td>string</td> |
|---|
| 452 | | <td> |
|---|
| 453 | | The string that marks the beginning of a token. |
|---|
| 454 | | </td> |
|---|
| 455 | | <td>@</td> |
|---|
| 456 | | <td>No</td> |
|---|
| 457 | | </tr> |
|---|
| 458 | | <tr> |
|---|
| 459 | | <td>endtoken</td> |
|---|
| 460 | | <td>string</td> |
|---|
| 461 | | <td> |
|---|
| 462 | | The string that marks the end of a token. |
|---|
| 463 | | </td> |
|---|
| 464 | | <td>@</td> |
|---|
| 465 | | <td>No</td> |
|---|
| 466 | | </tr> |
|---|
| 467 | | </tbody> |
|---|
| 468 | | </table> |
|---|
| 469 | | <h3>Nested Tags</h3> |
|---|
| 470 | | <p> |
|---|
| 471 | | The <em>ReplaceTokens</em> filter must contain one or more <em>token</em> |
|---|
| 472 | | tags. These must have a <em>key</em> and a <em>value</em> attribute. |
|---|
| 473 | | </p> |
|---|
| 474 | | |
|---|
| 475 | | <h2><a name="ReplaceRegexp"></a>ReplaceRegexp</h2> |
|---|
| 476 | | <p> |
|---|
| 477 | | The <em>ReplaceRegexp</em> filter will perform a regexp find/replace on the input |
|---|
| 478 | | stream. For example, if you want to replace ANT with Phing (ignoring case) and you want |
|---|
| 479 | | to replace references to *.java with *.php: |
|---|
| 480 | | </p> |
|---|
| 481 | | <pre> |
|---|
| 482 | | <filterchain> |
|---|
| 483 | | <replaceregexp> |
|---|
| 484 | | <regexp pattern="ANT" replace="Phing" ignoreCase="true"/> |
|---|
| 485 | | <regexp pattern="(\w+)\.java" replace="\1.php"/> |
|---|
| 486 | | </replaceregexp> |
|---|
| 487 | | </filterchain> |
|---|
| 488 | | </pre> |
|---|
| 489 | | |
|---|
| 490 | | <h3>Nested Tags</h3> |
|---|
| 491 | | <p> |
|---|
| 492 | | The <em>ReplaceTokens</em> filter must contain one or more <em>regexp</em> |
|---|
| 493 | | tags. These must have <em>pattern</em> and <em>replace</em> attributes -- and optionally |
|---|
| 494 | | the <em>ignoreCase</em> attribute. |
|---|
| 495 | | </p> |
|---|
| 496 | | |
|---|
| 497 | | |
|---|
| 498 | | <h2><a name="StripLineBreaks"></a>StripLineBreaks</h2> |
|---|
| 499 | | <p> |
|---|
| 500 | | The <em>StripLineBreaks</em> filter removes all linebreaks from the |
|---|
| 501 | | stream passed through the filter chain. |
|---|
| 502 | | </p> |
|---|
| 503 | | <pre> |
|---|
| 504 | | <filterchain> |
|---|
| 505 | | <striplinebreaks /> |
|---|
| 506 | | </filterchain> |
|---|
| 507 | | </pre> |
|---|
| 508 | | |
|---|
| 509 | | <h2><a name="StripLineComments"></a>StripLineComments</h2> |
|---|
| 510 | | <p> |
|---|
| 511 | | The <em>StripLineComments</em> filter removes all line comments from |
|---|
| 512 | | the stream passed through the filter chain: |
|---|
| 513 | | </p> |
|---|
| 514 | | <pre> |
|---|
| 515 | | <filterchain> |
|---|
| 516 | | <striplinecomments> |
|---|
| 517 | | <comment value="#" /> |
|---|
| 518 | | <comment value="--" /> |
|---|
| 519 | | <comment value="//" /> |
|---|
| 520 | | </striplinecomments> |
|---|
| 521 | | </filterchain> |
|---|
| 522 | | </pre> |
|---|
| 523 | | |
|---|
| 524 | | <h3>Nested Tags</h3> |
|---|
| 525 | | <p> |
|---|
| 526 | | The <em>striplinecomments</em> tag must contain one or more <em>comment</em> |
|---|
| 527 | | tags. These must have a <em>value</em> attribute that specifies the |
|---|
| 528 | | character(s) that start a line comment. |
|---|
| 529 | | </p> |
|---|
| 530 | | |
|---|
| 531 | | <h2><a name="StripPhpComments"></a>StripPhpComments</h2> |
|---|
| 532 | | <p> |
|---|
| 533 | | The <em>StripPhpComments</em> filter removes all PHP comments from |
|---|
| 534 | | the stream passed through the filter. |
|---|
| 535 | | </p> |
|---|
| 536 | | <pre> |
|---|
| 537 | | <filterchain> |
|---|
| 538 | | <stripphpcomments /> |
|---|
| 539 | | </filterchain> |
|---|
| 540 | | </pre> |
|---|
| 541 | | |
|---|
| 542 | | <h2><a name="StripWhitespace"></a>StripWhitespace</h2> |
|---|
| 543 | | <p> |
|---|
| 544 | | The <em>StripWhitespace</em> filter removes all PHP comments and whitespace from |
|---|
| 545 | | the stream passed through the filter. Internally, this filter uses the php_strip_whitespace() function. |
|---|
| 546 | | </p> |
|---|
| 547 | | <pre> |
|---|
| 548 | | <filterchain> |
|---|
| 549 | | <stripwhitespace /> |
|---|
| 550 | | </filterchain> |
|---|
| 551 | | </pre> |
|---|
| 552 | | |
|---|
| 553 | | <h2><a name="TabToSpaces"></a>TabToSpaces</h2> |
|---|
| 554 | | <p> |
|---|
| 555 | | The TabToSpaces filter replaces all tab characters with a given |
|---|
| 556 | | count of space characters. |
|---|
| 557 | | </p> |
|---|
| 558 | | <pre> |
|---|
| 559 | | <filterchain> |
|---|
| 560 | | <tabtospaces tablength="8" /> |
|---|
| 561 | | </filterchain> |
|---|
| 562 | | </pre> |
|---|
| 563 | | <h3>Attributes</h3> |
|---|
| 564 | | <table> |
|---|
| 565 | | <caption> |
|---|
| 566 | | Attributes for the <em><tabtospaces></em> filter |
|---|
| 567 | | </caption> |
|---|
| 568 | | <thead> |
|---|
| 569 | | <tr> |
|---|
| 570 | | <th>Name</th> |
|---|
| 571 | | <th>Type</th> |
|---|
| 572 | | <th>Description</th> |
|---|
| 573 | | <th>Default</th> |
|---|
| 574 | | <th>Required</th> |
|---|
| 575 | | </tr> |
|---|
| 576 | | </thead> |
|---|
| 577 | | <tbody> |
|---|
| 578 | | <tr> |
|---|
| 579 | | <td>tablength</td> |
|---|
| 580 | | <td>Integer</td> |
|---|
| 581 | | <td> |
|---|
| 582 | | The number of space characters that a tab is to represent. |
|---|
| 583 | | </td> |
|---|
| 584 | | <td>8</td> |
|---|
| 585 | | <td>No</td> |
|---|
| 586 | | </tr> |
|---|
| 587 | | </tbody> |
|---|
| 588 | | </table> |
|---|
| 589 | | |
|---|
| 590 | | <h2><a name="TailFilter"></a>TailFilter</h2> |
|---|
| 591 | | <p> |
|---|
| 592 | | Similar to <a href="#HeadFilter">HeadFilter</a>, |
|---|
| 593 | | this filter reads the last <em>n</em> lines of a file; the others |
|---|
| 594 | | are not further passed through the filter chain. Usage example: |
|---|
| 595 | | </p> |
|---|
| 596 | | <pre> |
|---|
| 597 | | <filterchain> |
|---|
| 598 | | <tailfilter lines="20" /> |
|---|
| 599 | | </filterchain> |
|---|
| 600 | | </pre> |
|---|
| 601 | | <h3>Attributes</h3> |
|---|
| 602 | | <table> |
|---|
| 603 | | <caption> |
|---|
| 604 | | Attributes for the <em><tailfilter></em> tag |
|---|
| 605 | | </caption> |
|---|
| 606 | | <thead> |
|---|
| 607 | | <tr> |
|---|
| 608 | | <th>Name</th> |
|---|
| 609 | | <th>Type</th> |
|---|
| 610 | | <th>Description</th> |
|---|
| 611 | | <th>Default</th> |
|---|
| 612 | | <th>Required</th> |
|---|
| 613 | | </tr> |
|---|
| 614 | | </thead> |
|---|
| 615 | | <tbody> |
|---|
| 616 | | <tr> |
|---|
| 617 | | <td>lines</td> |
|---|
| 618 | | <td>Integer</td> |
|---|
| 619 | | <td> |
|---|
| 620 | | Number of lines from the back to read. |
|---|
| 621 | | </td> |
|---|
| 622 | | <td>10</td> |
|---|
| 623 | | <td>No</td> |
|---|
| 624 | | </tr> |
|---|
| 625 | | </tbody> |
|---|
| 626 | | </table> |
|---|
| 627 | | |
|---|
| 628 | | <h2><a name="XincludeFilter"></a>XincludeFilter</h2> |
|---|
| 629 | | <p> |
|---|
| 630 | | The <em>XincludeFilter</em> processes a stream for Xinclude tags, and processes the inclusions. |
|---|
| 631 | | This is useful for processing modular XML files. DocBook book files are one example of |
|---|
| 632 | | modular XML files. Usage example: |
|---|
| 633 | | <pre> |
|---|
| 634 | | <!-- |
|---|
| 635 | | Render a DocBook book file called manual.xml, which |
|---|
| 636 | | contains Xinclude tags to include individual book sections. |
|---|
| 637 | | --> |
|---|
| 638 | | <copy todir="${manual.dest.dir}"> |
|---|
| 639 | | <filterchain> |
|---|
| 640 | | <xincludefilter basedir="${manual.src.dir}" /> |
|---|
| 641 | | <xsltfilter style="${manual.src.dir}/html.xsl"> |
|---|
| 642 | | <param name="base.dir" expression="${manual.dest.dir}/" /> |
|---|
| 643 | | </xsltfilter> |
|---|
| 644 | | </filterchain> |
|---|
| 645 | | <fileset dir="${manual.src.dir}"> |
|---|
| 646 | | <include name="manual.xml" /> |
|---|
| 647 | | </fileset> |
|---|
| 648 | | </copy> |
|---|
| 649 | | </pre> |
|---|
| 650 | | <h3>Attributes</h3> |
|---|
| 651 | | <table> |
|---|
| 652 | | <caption> |
|---|
| 653 | | Attributes for the <em><xincludefilter></em> tag |
|---|
| 654 | | </caption> |
|---|
| 655 | | <thead> |
|---|
| 656 | | <tr> |
|---|
| 657 | | <th>Name</th> |
|---|
| 658 | | <th>Type</th> |
|---|
| 659 | | <th>Description</th> |
|---|
| 660 | | <th>Default</th> |
|---|
| 661 | | <th>Required</th> |
|---|
| 662 | | </tr> |
|---|
| 663 | | </thead> |
|---|
| 664 | | <tbody> |
|---|
| 665 | | <tr> |
|---|
| 666 | | <td>basedir</td> |
|---|
| 667 | | <td>String</td> |
|---|
| 668 | | <td> |
|---|
| 669 | | The working directory from which to |
|---|
| 670 | | process the Xincludes. Relative pathnames |
|---|
| 671 | | in the include tags are based on this |
|---|
| 672 | | location. |
|---|
| 673 | | </td> |
|---|
| 674 | | <td>Project basedir</td> |
|---|
| 675 | | <td>No</td> |
|---|
| 676 | | </tr> |
|---|
| 677 | | </tbody> |
|---|
| 678 | | </table> |
|---|
| 679 | | |
|---|
| 680 | | |
|---|
| 681 | | <h2><a name="XsltFilter"></a>XsltFilter</h2> |
|---|
| 682 | | <p> |
|---|
| 683 | | The <em>XsltFilter</em> applies a XSL template to the stream. |
|---|
| 684 | | Though you can use this filter directly, you should use |
|---|
| 685 | | <a href="AppendixB-CoreTasks.html#XsltTask">XsltTask</a> |
|---|
| 686 | | which is shortcut to the following lines: |
|---|
| 687 | | </p> |
|---|
| 688 | | <pre> |
|---|
| 689 | | <filterchain> |
|---|
| 690 | | <xsltfilter style="somexslt.xsl" /> |
|---|
| 691 | | </filterchain> |
|---|
| 692 | | </pre> |
|---|
| 693 | | <h3>Attributes</h3> |
|---|
| 694 | | <table> |
|---|
| 695 | | <caption> |
|---|
| 696 | | Attributes for the <em><xsltfilter></em> tag |
|---|
| 697 | | </caption> |
|---|
| 698 | | <thead> |
|---|
| 699 | | <tr> |
|---|
| 700 | | <th>Name</th> |
|---|
| 701 | | <th>Type</th> |
|---|
| 702 | | <th>Description</th> |
|---|
| 703 | | <th>Default</th> |
|---|
| 704 | | <th>Required</th> |
|---|
| 705 | | </tr> |
|---|
| 706 | | </thead> |
|---|
| 707 | | <tbody> |
|---|
| 708 | | <tr> |
|---|
| 709 | | <td>style</td> |
|---|
| 710 | | <td>String</td> |
|---|
| 711 | | <td> |
|---|
| 712 | | The XSLT stylesheet to use for transformation. |
|---|
| 713 | | </td> |
|---|
| 714 | | <td>n/a</td> |
|---|
| 715 | | <td>Yes</td> |
|---|
| 716 | | </tr> |
|---|
| 717 | | <tr> |
|---|
| 718 | | <td>html</td> |
|---|
| 719 | | <td>Boolean</td> |
|---|
| 720 | | <td> |
|---|
| 721 | | Whether to parse the input as HTML (using libxml2 DOMDocument::loadHTML()). |
|---|
| 722 | | </td> |
|---|
| 723 | | <td>false</td> |
|---|
| 724 | | <td>No</td> |
|---|
| 725 | | </tr> |
|---|
| 726 | | </tbody> |
|---|
| 727 | | </table> |
|---|
| 728 | | |
|---|
| 729 | | <h3>Nested Tags</h3> |
|---|
| 730 | | <p> |
|---|
| 731 | | The <em>XsltFilter</em> filter may contain one or more <em>param</em> |
|---|
| 732 | | tags to pass any XSLT parameters to the stylesheet. These <em>param</em> tags |
|---|
| 733 | | must have <em>name</em> and <em>expression</em> attributes. |
|---|
| 734 | | </p> |
|---|
| 735 | | |
|---|
| 736 | | <h2><a name="CoreMappers"></a>Core Mappers</h2> |
|---|
| 737 | | <p> |
|---|
| 738 | | While filters are applied to the <em>content</em> of files, Mappers |
|---|
| 739 | | are applied to the <em>filenames</em>. All mappers have the same |
|---|
| 740 | | API, i.e. the way you use them is the same: |
|---|
| 741 | | </p> |
|---|
| 742 | | <pre> |
|---|
| 743 | | <mapper type="<em>mappername</em>" from="<em>frompattern</em>" to="<em>topattern</em>" /> |
|---|
| 744 | | </pre> |
|---|
| 745 | | <h3>Attributes</h3> |
|---|
| 746 | | <table> |
|---|
| 747 | | <caption> |
|---|
| 748 | | Attributes for the <em><mapper></em> tag |
|---|
| 749 | | </caption> |
|---|
| 750 | | <thead> |
|---|
| 751 | | <tr> |
|---|
| 752 | | <th>Name</th> |
|---|
| 753 | | <th>Type</th> |
|---|
| 754 | | <th>Description</th> |
|---|
| 755 | | <th>Default</th> |
|---|
| 756 | | <th>Required</th> |
|---|
| 757 | | </tr> |
|---|
| 758 | | </thead> |
|---|
| 759 | | <tbody> |
|---|
| 760 | | <tr> |
|---|
| 761 | | <td>type</td> |
|---|
| 762 | | <td>String</td> |
|---|
| 763 | | <td> |
|---|
| 764 | | Type of the mapper. |
|---|
| 765 | | </td> |
|---|
| 766 | | <td>n/a</td> |
|---|
| 767 | | <td>Yes</td> |
|---|
| 768 | | </tr> |
|---|
| 769 | | <tr> |
|---|
| 770 | | <td>from</td> |
|---|
| 771 | | <td>String</td> |
|---|
| 772 | | <td> |
|---|
| 773 | | The pattern the filename is to be matched to. The |
|---|
| 774 | | exact meaning is dependent on the implementation |
|---|
| 775 | | of the mapper. |
|---|
| 776 | | </td> |
|---|
| 777 | | <td>n/a</td> |
|---|
| 778 | | <td>depends on the implementation of the mapper</td> |
|---|
| 779 | | </tr> |
|---|
| 780 | | <tr> |
|---|
| 781 | | <td>to</td> |
|---|
| 782 | | <td>String</td> |
|---|
| 783 | | <td> |
|---|
| 784 | | The pattern according to which the filename is to |
|---|
| 785 | | be changed to. Here, the usage is dependent on |
|---|
| 786 | | the implementation of the mapper, too. |
|---|
| 787 | | </td> |
|---|
| 788 | | <td>n/a</td> |
|---|
| 789 | | <td>depends on the implementation of the mapper</td> |
|---|
| 790 | | </tr> |
|---|
| 791 | | </tbody> |
|---|
| 792 | | </table> |
|---|
| 793 | | |
|---|
| 794 | | <h2><a name="FlattenMapper"></a>FlattenMapper</h2> |
|---|
| 795 | | <p> |
|---|
| 796 | | The <em>FlattenMapper</em> removes the directories from |
|---|
| 797 | | a filename and solely returns the filename. |
|---|
| 798 | | </p> |
|---|
| 799 | | <pre> |
|---|
| 800 | | <copy todir="/tmp"> |
|---|
| 801 | | <mapper type="flatten" /> |
|---|
| 802 | | |
|---|
| 803 | | <fileset refid="someid" /> |
|---|
| 804 | | </copy> |
|---|
| 805 | | </pre> |
|---|
| 806 | | <p> |
|---|
| 807 | | This code will copy all files in the fileset to /tmp. All |
|---|
| 808 | | files will be in the target directory. |
|---|
| 809 | | </p> |
|---|
| 810 | | <h3>Examples</h3> |
|---|
| 811 | | <pre> |
|---|
| 812 | | <mapper type="flatten" /> |
|---|
| 813 | | </pre> |
|---|
| 814 | | <p> |
|---|
| 815 | | Applying the mapper, you will get the following results from the |
|---|
| 816 | | following filenames: |
|---|
| 817 | | </p> |
|---|
| 818 | | <table> |
|---|
| 819 | | <tr> |
|---|
| 820 | | <th>From</th> |
|---|
| 821 | | <th>To</th> |
|---|
| 822 | | </tr> |
|---|
| 823 | | <tr> |
|---|
| 824 | | <td>test.txt</td> |
|---|
| 825 | | <td>test.txt</td> |
|---|
| 826 | | </tr> |
|---|
| 827 | | <tr> |
|---|
| 828 | | <td>./foo/bar/test.bak</td> |
|---|
| 829 | | <td>test.bak</td> |
|---|
| 830 | | </tr> |
|---|
| 831 | | </table> |
|---|
| 832 | | |
|---|
| 833 | | <h2><a name="GlobMapper"></a>GlobMapper</h2> |
|---|
| 834 | | <p> |
|---|
| 835 | | The <em>GlobMapper</em> works like the <em>copy</em> command in DOS: |
|---|
| 836 | | </p> |
|---|
| 837 | | <pre> |
|---|
| 838 | | <copy todir="/tmp"> |
|---|
| 839 | | <mapper type="glob" from="*.php" to="*.php.bak"/> |
|---|
| 840 | | |
|---|
| 841 | | <fileset refid="someid" /> |
|---|
| 842 | | </copy> |
|---|
| 843 | | </pre> |
|---|
| 844 | | <p> |
|---|
| 845 | | This will change the extension of all files matching the pattern |
|---|
| 846 | | <em>*.php</em> to <em>.php.bak</em>. |
|---|
| 847 | | </p> |
|---|
| 848 | | <h3>Examples</h3> |
|---|
| 849 | | <pre> |
|---|
| 850 | | <mapper type="glob" from="*txt" to="*txt.bak"/> |
|---|
| 851 | | </pre> |
|---|
| 852 | | <p> |
|---|
| 853 | | Applying the mapper, you will get the following results from the |
|---|
| 854 | | following filenames: |
|---|
| 855 | | </p> |
|---|
| 856 | | <table> |
|---|
| 857 | | <tr> |
|---|
| 858 | | <th>From</th> |
|---|
| 859 | | <th>To</th> |
|---|
| 860 | | </tr> |
|---|
| 861 | | <tr> |
|---|
| 862 | | <td>test.txt</td> |
|---|
| 863 | | <td>test.txt.bak</td> |
|---|
| 864 | | </tr> |
|---|
| 865 | | <tr> |
|---|
| 866 | | <td>./foo/bar/test.txt</td> |
|---|
| 867 | | <td>./foo/bar/test.txt.bak</td> |
|---|
| 868 | | </tr> |
|---|
| 869 | | <tr> |
|---|
| 870 | | <td>mytxt</td> |
|---|
| 871 | | <td>mytxt.bak</td> |
|---|
| 872 | | </tr> |
|---|
| 873 | | <tr> |
|---|
| 874 | | <td>SomeClass.php</td> |
|---|
| 875 | | <td><em>ignored</em>, SomeClass.php</td> |
|---|
| 876 | | </tr> |
|---|
| 877 | | </table> |
|---|
| 878 | | |
|---|
| 879 | | <h2><a name="IdentityMapper"></a>IdentityMapper</h2> |
|---|
| 880 | | <p> |
|---|
| 881 | | The <em>IdentityMapper</em> will not change anything on the |
|---|
| 882 | | source filenames. |
|---|
| 883 | | </p> |
|---|
| 884 | | |
|---|
| 885 | | <h2><a name="MergeMapper"></a>MergeMapper</h2> |
|---|
| 886 | | <p> |
|---|
| 887 | | The <em>MergeMapper</em> changes all source filenames to the same |
|---|
| 888 | | filename. |
|---|
| 889 | | </p> |
|---|
| 890 | | <h3>Examples</h3> |
|---|
| 891 | | <pre> |
|---|
| 892 | | <mapper type="merge" to="test.tar"/> |
|---|
| 893 | | </pre> |
|---|
| 894 | | <p> |
|---|
| 895 | | Applying the mapper, you will get the following results from the |
|---|
| 896 | | following filenames: |
|---|
| 897 | | </p> |
|---|
| 898 | | <table> |
|---|
| 899 | | <tr> |
|---|
| 900 | | <th>From</th> |
|---|
| 901 | | <th>To</th> |
|---|
| 902 | | </tr> |
|---|
| 903 | | <tr> |
|---|
| 904 | | <td>test.txt</td> |
|---|
| 905 | | <td>test.tar</td> |
|---|
| 906 | | </tr> |
|---|
| 907 | | <tr> |
|---|
| 908 | | <td>./foo/bar/test.txt</td> |
|---|
| 909 | | <td>test.tar</td> |
|---|
| 910 | | </tr> |
|---|
| 911 | | <tr> |
|---|
| 912 | | <td>mytxt</td> |
|---|
| 913 | | <td>test.tar</td> |
|---|
| 914 | | </tr> |
|---|
| 915 | | <tr> |
|---|
| 916 | | <td>SomeClass.php</td> |
|---|
| 917 | | <td>test.tar</td> |
|---|
| 918 | | </tr> |
|---|
| 919 | | </table> |
|---|
| 920 | | |
|---|
| 921 | | <h2><a name="RegexpMapper"></a>RegexpMapper</h2> |
|---|
| 922 | | <p> |
|---|
| 923 | | The <em>RegexpMapper</em> changes filenames according to a pattern |
|---|
| 924 | | defined by a regular expression. This is the most powerful mapper and |
|---|
| 925 | | you should be able to use it for every possible application. |
|---|
| 926 | | </p> |
|---|
| 927 | | <h3>Examples</h3> |
|---|
| 928 | | <pre> |
|---|
| 929 | | <mapper type="regexp" from="^(.*)\.conf\.xml" to="\1.php"/> |
|---|
| 930 | | </pre> |
|---|
| 931 | | <p> |
|---|
| 932 | | The mapper as above will do the following mappings: |
|---|
| 933 | | </p> |
|---|
| 934 | | <table> |
|---|
| 935 | | <tr> |
|---|
| 936 | | <th>From</th> |
|---|
| 937 | | <th>To</th> |
|---|
| 938 | | </tr> |
|---|
| 939 | | <tr> |
|---|
| 940 | | <td>test.txt</td> |
|---|
| 941 | | <td><em>ignore</em>, test.txt</td> |
|---|
| 942 | | </tr> |
|---|
| 943 | | <tr> |
|---|
| 944 | | <td>./foo/bar/test.conf.xml</td> |
|---|
| 945 | | <td>./foo/bar/test.php</td> |
|---|
| 946 | | </tr> |
|---|
| 947 | | <tr> |
|---|
| 948 | | <td>someconf.conf.xml</td> |
|---|
| 949 | | <td>someconf.php</td> |
|---|
| 950 | | </tr> |
|---|
| 951 | | </table> |
|---|
| 952 | | |
|---|
| 953 | | </body> |
|---|
| | 182 | </body> |
|---|