XSLT optimizations for PDF stylesheets

Backported from version 2.0 (#1672). This commit only includes the XSLT1-compatible changes in that PR.

The table/fig/fn numbering optimizations in #1672 use node comparison operators, which are only available in XPath 2, so we can't use them directly in 1.8 (which is XSLT1-only). It might be possible to backport the changes to XSLT1 somehow, but I'm not sure how much of an effect that'd have, and I can't get exact profiling data because the XSLT stylesheets in 1.8 use EXSLT extensions, which means I can't easily use Saxon HE to profile the stylesheets. Saxon B doesn't have the profiling feature as far as I can tell.

These changes were tested using [these fixtures](https://github.com/eerohele/dita-ot-issues/tree/master/fixtures/1672) and the DITA 1.2 Specification, just as #1672. DITA-OT produces the same `topic.fo` file in both cases both before and after applying these changes, so this shouldn't break anything.

No profiling data since I can't profile the stylesheets, but a quick test suggests that these changes shave about 1.5 minutes off the entire processing time for the DITA 1.2 Specification.