A new serialization property saxon:internal-dtd-subset is available with the XML output method (see Serialization parameters). The value is a string conforming to the XML grammar production intSubset; it is included in the serialized document "as is", without checking. As with any string, special characters will need to be escaped, for example "<" is written as "&lt;". The square brackets that enclose the internal subset within the Document Type Declaration should not be included in the value.

When used with xsl:result-document or fn:serialize(), the value can be constructed programmatically. This provides an alternative to the saxon:doctype extension instruction, and is a better solution to the requirement architecturally because it sits firmly in the serialization arena rather than masquerading as an instruction affecting the contents of the result tree.