Generating file ...

Conditions and multiple models

Next, we'd like to format the bible quote and make the text italic. If you add an elementSpec for quote, you will see that it has two models by default. The first one has a condition, which is reflected in the description and the corresponding XPath printed in red below. Conditions allow you to distinguish uses of the same element in different contexts. In the given scenario, quote will be rendered inline if it has a p, cell or cit ancestor. Otherwise the second model outputs it as a block.

The processing model uses a predicate to make such distinctions: a model rule will only be used if the XPath expression in its predicate matches the current node being processed. And if there's more than one model within an elementSpec, only the first model matching all conditions will be used. Any model after the matching one will be ignored.

Since our quote is indeed located within a cit element, we have to modify the first model:

elementSpec for quote

The sermons look better now, but we still have the bible reference inlined before the bible quote. We want to make this a block and center it:

  1. add an elementSpec for ref with behaviour block

  2. it should be limited to canonical references, which we could express by adding a predicate @type="can". However, this would apply to all bible references in the text. Therefore the predicate needs to be further limited to canonical references within the epigraph:

    @type="can" and ancestor::epigraph
  3. add an outputRendition to center the text:

    text-align: center;

Applying this change, the bible reference becomes centered above the bible passage. So far so good. Unfortunately it is no longer a link because we turned it into a block. To again make it a link, we need to introduce another key concept: parameters.