Conditional Formatting
Basic Principles
Many XML formatting engines allow you to test the hierarchy of content and associate formatting properties based on the result of those tests. PTC Advanced Print Publisher provides this functionality, using XPath and counters, and has other information available to provide additional flexibility.
PTC Advanced Print Publisher provides these tools to template developers for conditional formatting:
• Attribute testing — classed as separate from XPath with the way PTC Advanced Print Publisher passes attributes to the tags selected during text formatting
• Formatting results — a powerful tool to use to specify formatting based on information PTC Advanced Print Publisher generates while it is formatting
Formatting results are obtained from PTC Advanced Print Publisher’s getvar variables.
• XPath — a standard language to test XML content hierarchy and long-range content structures
• Global variables — can be passed between documents and are always available from any content stream, tag, or script
• Counters — a format-safe way to store information that can be tested later
• Tag information — graphic and text information can be used to further drive conditional formatting
• Environment information — information such as date and time, user name, operating system, and PTC Advanced Print Publisher deployment accessed from PTC Advanced Print Publisher
The majority of this information is available through JavaScript. It may be necessary use other methods to access some of the information, for example using showstrings or Perl.