XML Viewer webpart y mensaje “Failed to apply XSLT to the content” en MOSS 2007 y SPS 2010

Hola

Alguno de vosotros a lo mejor os habéis encontrado que usando el XML Viewer webpart tanto en MOSS 2007 y SPS 2010 cuando renderiza el xml contra el xsl se muestra "Failed to apply XSLT to the content”

Esto ocurre debido a un cambio en .NET para evitar ataques de denegación de servicio (DoS attack) los DTDs (Document Type Definition) de los xmls. La documentación pública que apunta porque no se puede usar DTDs es la siguiente

DTDs Are Not Secure

Entities in DTDs are inherently not secure. It is possible for a malicious XML document that contains a DTD to cause the parser to use all memory and CPU time, causing a denial of service attack. Therefore, DTD processing is turned off by default. You should not accept DTDs from untrusted sources.

An example of accepting DTDs from untrusted sources would be a Web application that allowed Web users to upload an XML file that references a DTD and a DTD file. Upon validation of the file, a malicious DTD could execute a denial of service attack on your server. Another example of accepting DTDs from untrusted sources would be to reference a DTD on a network share that also allows anonymous FTP access.

                 https://msdn.microsoft.com/en-us/library/ms761392(VS.85).aspx

También documentado aquí

                 https://msdn.microsoft.com/en-us/magazine/ee335713.aspx

Entonces a partir del CU de Febrero de 2011 en MOSS 2007 y en SharePoint 2010 en ese webpart todos los xmls con DTD tanto de fuentes seguras como inseguras como maliciosos.

La solución es directamente borrar el DTD del xml.

Gracias.

Un saludo.

Héctor Calvarro Martín. SharePoint Dev/Core. Microsoft Support Escalation Engineer for EMEA

Héctor