Request a trial-version now and see for yourself!
Contact us at [email protected].
In the previous exercises we worked with just text. In this exercise we will add an image to the template. Also, when using the ForEach we learned about a so-called context-node which made the data queries relative and therefore shorter. The UseContext-placeholder provides similar functionality for regular situations.
The prerequisites for these exercises are listed on the Quick-Start introduction-page.
This exercise uses the same data-file as the previous exercise. You can download it here: http://static.docati.com/samples/order-basic.xml (you must save it to a local folder on your computer, you need it later).
The template contains a company logo (the Docati-logo). In exercise 1 we inserted the name of the company by using a ValueOf-placeholder. It makes sense to add the company logo dynamically as well.
When working with the ForEach-placeholder, you may have noticed the queries for the ValueOf-placeholders did not specify unique element names (for example: there were more than one ProductName-nodes in the XML-document). However, the queries did work, because the ForEach-placeholder supplied a context-node for each row (the Item-node). This caused the queries to be relative to the context-node, meaning ValueOf-placeholders inside the row only searched within/below the Item-node for that row. This is also possible when not iterating through lists.
By using the UseContext-placeholder, its inner-placeholders are easier to configure, because of the shorter path-values, especially when using advanced queries. This is better for maintainability of the template.
Tip: When placeholders are located close to each other or contained by other placeholders, the structure of the placeholders may get confusing, like with the UseContext or the ForEach placeholders in these exercises. In the image below, the ValueOf-placeholder is selected, but if you want to modify the settings of the surrounding ForEach-placeholder, it becomes hard to actually select it:
In this case it may help to add newlines or spaces inside table cells (and remove them afterwards if they mess up the final document).
Another solution is the “Direct Edit”-button on the Docati-ribbon. It will display the structure of the placeholders and allows you to modify their settings. It looks like this: