“The formula contains one or more errors.
Duplicate attribute”
I got it when trying to add ,xsl as Data Connections to InfoPath then add new Rules to controls. Following this guide. It’s resolved the problem
http://www.softobject.com/sites/Blog/Lists/Posts/Post.aspx?ID=4
“
DUPLICATE ATTRIBUTE ERROR:
This happens when a XSL file is added to the form as 2ndary data source. The namespace in the XSL conflicts what's in Form's ns.
RESOLUTION:
Do not add XSL as 2ndary data source. Instead add it as form's Resource File. Change your code that might be doing the XSLT transform to load the XSL manually. This fixes it as charm!
Work around code instead of havinf XSL as a secondary data source
WITH XSL AS SECONDARY DATA SOURCE, YOU COULD HAVE DONE SOMETHING LIKE THIS:
custom.HTMLDocument.body.innerHTML = thisXDocument.DOM.transformNode(thisXDocument.GetDOM("SummaryReport"));
NOW SINCE THAT CAUSES NAMESPACE CONFUSION/CONFLICT, DO THE XSLT LIKE THIS:
IXMLDOMDocument XSLTFileDOM = thisXDocument.CreateDOM();
XSLTFileDOM.async = false;
XSLTFileDOM.validateOnParse = false;
XSLTFileDOM.load("SummaryReport.xslt");
custom.HTMLDocument.body.innerHTML = thisXDocument.DOM.transformNode(XSLTFileDOM);
-DANIEL
“
It work for JScript. But C#, I don’t get the solution yet.
Quang Nguyen Ba - 8/21/2009 8:52:30 AM
After asking someone over Internet. I found the solution for it. Following the guide from Jimmy http://www.infopathdev.com/forums/p/1641/46072.aspx, It work well. Here are complete codes for implementing transformation from from Resource Files3: XmlReader xslTemplateReader = XmlReader.Create(xslTemplate);
4: trans.Load(xslTemplateReader);
7: myWriter.Close();