When the document(uri)
function is used to load another document within the XSLT, where the target document contains a DTD I get an XslTransformException
, containing an inner XmlException
:
For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method.
As the XmlReader
is created within the XSLT implementation there is no direct way to create the XmlReader with the settings I want, and none of the XslCompiledTransform
, XmlResolver
1 or related classes seem to provide any form of hook.
(I'm using a DTD to set some HTML entities to make the authoring of the document easier.)
1 based on looking at XmlUrlResolver
in Reflector this just loaded the URI's target as a Stream.
E.g. is the XSLT contains
and more.xml
contains a DTD then the exception above is the result.