title: XslCompiledTransform Transform call cause DTD crash
body: <p>I have some problems when I want transform an xml datas. I using XslCompiledTransform object on .Net framework 4.0.</p>
  
  <pre><code>XDocument v_xdoc = XDocument.Load("XLMData.xml");
  XslCompiledTransform myXslTrans = new XslCompiledTransform();
  myXslTrans.Load("XSLTFile1.xslt", new XsltSettings(true, false), null);
  XPathNavigator nav = v_xdoc.CreateNavigator();
  
  using (TextWriter myWriter = File.CreateText("result.scpt"))
  {
      myXslTrans.Transform(nav, null, myWriter);
  }
  </code></pre>
  
  <p>I have this crash:</p>
  
  <p>For safety reasons, in this document prohibited DTD XML. To enable DTD processing set on Parse the property on XmlReaderSettings DtdProcessing and pass parameters to the method XmlReader.Create.</p>
  
  <p>When I change my code with XmlReaderSettings :</p>
  
  <pre><code>XDocument v_xdoc = XDocument.Load("XLMData.xml");
  
  XslCompiledTransform myXslTrans = new XslCompiledTransform(true);
  myXslTrans.Load(
      XmlReader.Create("XSLTFile1.xslt", 
      new XmlReaderSettings()
      {
          DtdProcessing = DtdProcessing.Parse
      }),
      new XsltSettings(true, false),
      null
  );
  
  XPathNavigator nav = v_xdoc.CreateNavigator();
  using (TextWriter myWriter = File.CreateText("result.scpt"))
  {
      myXslTrans.Transform(nav, null, myWriter);
  }
  </code></pre>
  
  <p>I have the same crash. </p>
  
  <p>This is my XsltFile</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;!DOCTYPE xsl:stylesheet [
    &lt;!ENTITY nbsp "&amp;#x00A0;"&gt;
    &lt;!ENTITY euro "&amp;#8364;" &gt;
  ]&gt;
  
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:csv="csv:csv"
                  xmlns:n="http://novamap.fr/xml/data/v1"
                  version="1.0"&gt;
  
    &lt;xsl:output method="text" encoding="utf-8"/&gt;
  
    &lt;xsl:variable name="delimiter" select="';'"/&gt;
  
    &lt;csv:columns&gt;
      &lt;column&gt;BDC_ID_BON_DE_COMMANDE&lt;/column&gt;
      &lt;column&gt;BDC_LI_BON_DE_COMMANDE&lt;/column&gt;
      &lt;column&gt;BDC_REF_BON_DE_COMMANDE&lt;/column&gt;
      &lt;column&gt;BDC_DT_EMISSION_STR&lt;/column&gt;
    &lt;/csv:columns&gt;
  
    &lt;xsl:template match="/n:XmlModelBonDeCommande"&gt;
  
      &lt;xsl:for-each select="document('')/*/csv:columns/*"&gt;
        &lt;xsl:value-of select="."/&gt;
        &lt;xsl:if test="position() != last()"&gt;
          &lt;xsl:value-of select="$delimiter"/&gt;
        &lt;/xsl:if&gt;
      &lt;/xsl:for-each&gt;
  
      &lt;xsl:text&gt;
  &lt;/xsl:text&gt;
      &lt;!-- Output rows for each matched property --&gt;
      &lt;xsl:apply-templates select="n:GMP_BON_DE_COMMANDE"/&gt;
    &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>This is my XmlFile</p>
  
  <pre><code>&lt;XmlModelBonDeCommande xmlns="http://novamap.fr/xml/data/v1"&gt;
    &lt;GMP_BON_DE_COMMANDE&gt;
      &lt;BDC_ID_BON_DE_COMMANDE&gt;154&lt;/BDC_ID_BON_DE_COMMANDE&gt;
      &lt;BDC_LI_BON_DE_COMMANDE&gt;BON DE COMMANDE&lt;/BDC_LI_BON_DE_COMMANDE&gt;
      &lt;BDC_REF_BON_DE_COMMANDE&gt;20140624-08&lt;/BDC_REF_BON_DE_COMMANDE&gt;
      &lt;BDC_DT_EMISSION&gt;2014-06-24T02:00:00+02:00&lt;/BDC_DT_EMISSION&gt;
      &lt;BDC_DT_EMISSION_STR&gt;24/06/2014&lt;/BDC_DT_EMISSION_STR&gt;
      &lt;BDC_MT_MONTANT_HT&gt;132.38&lt;/BDC_MT_MONTANT_HT&gt;
      &lt;BDC_MT_MONTANT_HT_STR&gt;132,38&lt;/BDC_MT_MONTANT_HT_STR&gt;
      &lt;BDC_MT_MONTANT_TVA&gt;9.27&lt;/BDC_MT_MONTANT_TVA&gt;
      &lt;BDC_MT_MONTANT_TVA_STR&gt;9,27&lt;/BDC_MT_MONTANT_TVA_STR&gt;
      &lt;BDC_MT_MONTANT_TTC&gt;141.65&lt;/BDC_MT_MONTANT_TTC&gt;
      &lt;BDC_MT_MONTANT_TTC_STR&gt;141,65&lt;/BDC_MT_MONTANT_TTC_STR&gt;
    &lt;/GMP_BON_DE_COMMANDE&gt;
  &lt;/XmlModelBonDeCommande&gt;
  </code></pre>
  
  <p>The execution trace :</p>
  
  <pre><code>'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'c:\users\dell\documents\visual studio 2012\Projects\WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.exe' chargé, symboles chargés.
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml\v4.0_4.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll' chargé, chargement des symboles ignoré. Le module est optimisé et l'option du débogueur 'Uniquement mon code' est activée.
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' chargé, chargement des symboles ignoré. Le module est optimisé et l'option du débogueur 'Uniquement mon code' est activée.
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'System.Xml.Xsl.CompiledQuery.1' chargé
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'System.Xml.Xsl.CompiledQuery.2' chargé
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll' chargé
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.resources\v4.0_4.0.0.0_fr_b77a5c561934e089\System.Xml.resources.dll' chargé
  'WindowsFormsApplication4.vshost.exe' (Managé (v4.0.30319)) : 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml.resources\v4.0_4.0.0.0_fr_b77a5c561934e089\System.Data.SqlXml.resources.dll' chargé
  Une exception de première chance de type 'System.Xml.Xsl.XslTransformException' s'est produite dans System.Data.SqlXml.dll
  </code></pre>
  
  <p>and message exception : </p>
  
  <pre><code>Pour des raisons de sécurité, DTD interdite dans ce document XML. Pour activer le traitement DTD, définissez sur Parse la propriété DtdProcessing sur XmlReaderSettings et transmettez les paramètres à la méthode XmlReader.Create.
  </code></pre>
  
  <p>When i remove the DOCTYPE it work fine but i need it. I don't find the good arguments for load my xslt file. Someone have an idea ?</p>