The tc:block tag is used to group tc:conditional tags. The tc:conditional tags on their own can each have nested content that is only included in the generated document when the condition is true. However, when nested within a tc:block tag, multiple tc:conditional tags are handled differently.
The advantage of tc:block is to generate the same content, such as retrieving another XML file, when at least one of a group of conditions are met. For example, if one or more of five check-boxes is checked, then retrieve an XML file. Each tc:conditional tag that is nested within tc:block must have exactly the same content nested within it, so that no matter which condition is found to be true, the Document Generator generates the same content.
When tc:conditional tags are nested within tc:block, the Document Generator reads through each tc:conditional tag and checks the condition. As soon as it encounters a tc:conditional tag with a true condition, it generates that tag's nested content. It then ignores the rest of the tc:conditional tags in the block.
The following points will help you use tc:block:
•If you have several tc:conditional tags to include in a document template but they have different content that they will generate, then do NOT nest them within a tc:block tag. The purpose of using tc:block is to allow the same content to be generated, no matter which condition is met.
•You cannot nest any tags within a tc:block tag except for tc:conditional tags. Other tags can be nested within those tc:conditional tags, but they cannot be nested directly within the tc:block tag.
•Like tc:conditional, you can nest tc:block as needed within other tags.
Example: |
<tc:block> <tc:conditional compare="Detail[CLAM]/DetailValue[DrunkDriver],true"> <tc:file select="Statutes/RecklessStatute.xml" /> </tc:conditional> <tc:conditional compare="Detail[CLAM]/DetailValue[Speeding],true"> <tc:file select="Statutes/RecklessStatute.xml" /> </tc:conditional> </tc:block> |
In this example, the custom fields DrunkDriver and Speeding are specified. The conditions for these check-boxes are each set to true.
Note: The tag nested within each tc:conditional tag is exactly the same. If only one of these fields is checked, then the XML file named RecklessStatute.xml will be retrieved and included in the generated document.