The StyleAttrCSSResolver explained

The major function of a `CSSResolver` is detecting the right CSS for a given tag. The `StyleAttrCssResolver` uses the following criteria:

1. All inheritable CSS from the parent tag is added to the current tag.
2. All `CssFile` are checked for rules applying on the given tag in the order they were added to the `CSSResolver`. Rules defined on the same property are overridden.
3. Finally any CSS found in the tag's `style` attribute is added to the tags CSS.

Note that `CssFile`s can be added to a `CSSResolver` at any time. When adding a `CssFile` to the `StyleAttrCssResolver`, it's used by the resolving process immediately. There's no method to remove a `CssFile` in the `CSSResolver` interface, but that doesn't mean you can't add such a method in your custom implementation.

You can provide inheritance rules for the `StyleAttrCssResolver` class with the `setCssInheritanceRules()` method. By default, the `DefaultCssInheritanceRules` are used, but you can always write your own implementation of the `CssInheritanceRules` interface, for instance if you don't want certain CSS properties to be inherited from a tag.

All of this is very interesting if your XML is very similar to HTML and if your styles are defined using CSS. But if your XML is completely different, and if you need to produce content that doesn't fit in iText's `Element` objects, you'll need to write your own `Pipeline`.