The Auto-Calculation feature (i) displays the result of an XPath evaluation at any desired location in the output document, and (ii) optionally updates a node in the main XML document (the XML document being edited in Authentic View) with the result of the XPath evaluation.
The Auto-Calculation feature is a useful mechanism for:
•Inserting calculations involving operations on dynamic data values. For example, you can count the number of Employee elements in an Office element (with count(Employee)), or sum the values of all Price elements in each Invoice element (with sum(Price)), or join the FirstName and LastName elements of a Person element (with concat(FirstName, ' ', LastName)). In this way you can generate new data from dynamically changing data in the XML document, and send the generated data to the output.
•Displaying information derived from the structure of the document. For example, you can use the position() function of XPath to dynamically insert row numbers in a dynamic table, or to dynamically number the sections of a document. This has the advantage of automatically generating information based on dynamically changing document structures.
•Inserting data from external XML documents. The doc() function of XPath 2.0 provides access to the document root of external XML documents, and thus enables node content from the external XML document to be inserted in the output.
•Updating the value of nodes in the main XML document. For example, the node Addressee could be updated with an XPath expression like concat(Title, ' ', FirstName, ' ', LastName).
•Presenting the contents of a node at any location in the design.