Test accessing document's header from template.

This is an attempt to reproduce case from issue #16.