Select specific elements by context

Select a specific instance of an element based on its location within the structure.

Say you want to ensure that pages never break leaving a single list item stranded at the bottom of the page (a widow). You want to make sure that there are always at least two list items together at the bottom of a page, and if there is not sufficient space, the entire list flows to the following page.

To do this, you either need two attribute sets—one for the first <li> in an <ol>, <ul>, or <sl>—and another for the remaining <li> elements, or you need to conditionalize the existing attribute sets.

  1. If you do not already have a lists-attr.xsl file in your plugin, create it.
  2. In DITA-OT/plugins/org.dita.pdf2/cfg/fo/attrs/ ...