Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to use the XML Viewer web part in SharePoint 2010. Using the this XML

<?xml version="1.0" encoding="UTF-8"?>
<STOCKQUOTE ROWCOUNT='1'>
  <RESULT>
    <ROW>
      <COMPANYNAME>Test Company Name</COMPANYNAME>
    </ROW>
  </RESULT>
</STOCKQUOTE>

and this XSL

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
        <h2><xsl:value-of select="STOCKQUOTE/RESULT/ROW/COMPANYNAME" /></h2>
  </xsl:template>
</xsl:stylesheet>

in the XML editor and XSL editor of the web part options menu, when I click apply I get the error 'Failed to apply XSLT to the content'.

I have used this same XML/XSL in a VM development environment and it displays as expected, but when I try to create the same web part with the same XML/XSL in our test environment I get the said error. I have been working on this for some time and my google-fu isn't apparently working. Any idea what might be the issue or how to solve this? The only difference between the test and VM dev environments is that the test environment is two servers and load balanced. I have been told all other settings are the same.

Thanks in advance

*EDIT: So apparently I missed that there was a DOCTYPE defined for the XML in the test environment. Removing that allows it display. Since the XML will be coming from an outside source I will need to find out how to get around having a doctype defined.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The reason that this worked on a local VM and not in the test environment was because the service pack and CUs weren't installed on the VM. Once the VM was updated to the latest service pack and CU, the issue was replicated.

My solution, since I have no access to change the XML to remove the doctype, was to create custom web parts that did the call and display of data in code behind. It is no longer accessible for users to update, but these two specific web parts I was having trouble with were more a set it and forget type so no changes later should be necessary.

Hope it helps anyone who runs across this issue later.

share|improve this answer
    
Hey I am facing the exact same problem i.e. it is working fine on VM but not on test server. You say that we need to remove doctype from source XML to make it work but in my case there is no doctype defined in XML and still facing this issue. What could be the reason? –  Frank Martin Jul 18 '13 at 9:43
    
There are a quite a few different things that could be wrong to cause this error. It is pretty generic. Sometimes you can get a better understanding of what is failing by looking into the ULS log. Some of the common things I have found have been that the XSLT file was not well formed or the XML is not well formed. To troubleshoot I always strip it down to the bare minimum and start adding things back in. –  cvanhorn Jul 18 '13 at 21:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.