Internal cross-references
The discovery that processing references (to citations, i.e. endnotes) may require providing generated text where the .docx has only a placeholder suggests we are going to have to take similar care with cross-references. (Word supplies mechanisms to cross-reference to arbitrary sections or other targets, showing page numbers or generated text dynamically. These could well be represented by empty elements in the .docx.)
Specifically, we need to be sure that elements indicating cross-references are not removed in the scrub.xsl
stage, probably by providing them with some kind of content in an earlier pipeline step.