Idea is to write a Filter Stream output filter that will process an XDOM, make suitable replacements (to resolve links and images) and call the LaTeX Syntax renderer (LATEX-1).