No, the approach you are proposing is the mainstream
approach when you need to preserve physical details of the source XML that
aren't retained in the XDM model.
Andrew Welch has a tool that productizes the
My handy-dandy XSL transformation fails to preserve <!DOCTYPE>
declarations and &entity; usage as the XML parser reading the source XSL
document expands entities before the transformer sees the content.
There doesn't seem to be a reasonable solution using standard
The solution I'm considering now is to preprocess the file and turn
<!DOCTYPE> and entities into processing instructions, do the
transformation, and then postprocess the result to convert the processing
instructions back to <!DOCTYPE> and entities.
Is there a better strategy that I'm not seeing?