|
|
You may encounter anomalies in the display of a context defined using XPath in this way, if you are publishing with FOSI. If the source element is subsequently declared in the generated text of another element, the context of the source element defined with XPath cannot be processed by FOSI. You will be presented with a warning message. To overcome this, if it is your intention that the particular context of the source element that includes the XPath predicate is the one that should be processed in the generated text of the other element, include the XPath test in a condition of the original element, rather than a context.
For example, in your stylesheet you could define a table element with three contexts, each one of which uses an XPath predicate to set the font size of the table content based on the value of the pgwide attribute of the table (for example, the context table[@pgwide=90]) You might then decide that you want the title of your book to include a table, and set the generated text of the title in book context to always output a table, based on the > > menu option. If you then publish your document for print via FOSI you will see warning messages advising you that each of the contexts of the table element that contain the XPath predicate will be ignored for the table output in the title in book context, for example:
[A31450] ERROR: Cannot evaluate XPath expression in
stylesheet. An XPath Predicate is used in a Styler context for an element that occurs in generated text. (The predicate may have been generated by Styler to represent a position qualifier on a parent or ancestor.) This context will be ignored in FOSI-based outputs. Element: table. XPath expression: table[@pgwide=90]. To overcome this anomaly, create conditions based on XPath tests for the table, rather than contexts. For example, the condition If XPath expression (@pgwide=90) is true for the table will provide the same output for the table based on the pgwide attribute, but will not cause errors during publishing when the table element is used in generated text for the title in the book. If, however, the context with the XPath predicate is not the one that should be output in the generated text anyway, and its omission by FOSI has no bearing on the required output of your document, you may simply ignore the error message.
|
|
|
With DITA document types, predicates should only be attached to the element defined by the context. The use of general contexts such as image anywhere in topic[@outputclass=’tpdr’] should be avoided. They will not work in Edit view, and Arbortext Styler will not indicate that the context matches when you position the cursor in the edit window inside an element that should match. They will also not match in print/PDF output generated by the FOSI print engine.
Instead, use a context such as image[ancestor::topic/@outputclass=’tpdr’].
|
|
|
This method of testing predicates does not work if the predicate contains position(), or its shortcut form (just a number), or last(). However, these functions will function correctly when used in predicates in Arbortext Styler.
|