Xml Rules; Overview - Adobe 0046100128056 - InDesign - Mac Manual

Javascript
Table of Contents

Advertisement

13

XML Rules

The InDesign XML- rules feature provides a powerful set of scripting tools for working with the XML
content of your documents. XML rules also greatly simplify the process of writing scripts to work with XML
elements and dramatically improve performance of finding, changing, and formatting XML elements.
While XML rules can be triggered by application events, like open, place, and close, typically you will run
XML rules after importing XML into a document. (For more information on attaching scripts to events, see
Chapter 8,
This chapter gives an overview of the structure and operation of XML rules, and shows how to do the
following:
Define an XML rule.
Apply XML rules.
Find XML elements using XML rules.
Format XML data using XML rules.
Create page items based on XML rules.
Restructure data using XML rules.
Use the XML-rules processor.
We assume you already read Adobe InDesign CS5 Scripting Tutorial and know how to create and run a script.
We also assume you have some knowledge of XML and have read

Overview

InDesign's XML rules feature has three parts:
XML rules processor (a scripting object) — Locates XML elements in an XML structure using XPath
and applies the appropriate XML rule(s). It is important to note that a script can contain multiple XML
rule processor objects, and each rule-processor object is associated with a given XML rule set.
Glue code — A set of routines provided by Adobe to make the process of writing XML rules and
interacting with the XML rules-processor easier.
XML rules — The XML actions you add to a script. XML rules are written in scripting code. A rule
combines an XPath-based condition and a function to apply when the condition is met. The "apply"
function can perform any set of operations that can be defined in InDesign scripting, including
changing the XML structure; applying formatting; and creating new pages, page items, or documents.
A script can define any number of rules and apply them to the entire XML structure of an InDesign
document or any subset of elements within the XML structure. When an XML rule is triggered by an XML
rule processor, the rule can apply changes to the matching XML element or any other object in the
document.
You can think of the XML rules feature as being something like XSLT. Just as XSLT uses XPath to locate XML
elements in an XML structure, then transforms the XML elements in some way, XML rules use XPath to
"Events.")
Chapter 12, "XML."
178

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs5

Table of Contents