Duplicate Attribute when adding a new data connection - InfoPath Dev
in

InfoPath Dev

Duplicate Attribute when adding a new data connection

Last post 08-19-2009 08:02 PM by basquang. 15 replies.
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts: Previous Next
  • 03-10-2009 03:28 PM

    • Kwirk
    • Not Ranked
    • Joined on 03-10-2009
    • Posts 9

    Duplicate Attribute when adding a new data connection

    I am following S.Y.M. Wong-A-Ton's article Convert an InfoPath 2007 form into a Word 2007 document using XSLT and C#.  I have successfully accomplished this with one of my InfoPath forms with no problems. 

     I'm now trying to do it again with a different InfoPath form.  However after I add the new data connection to receive data, I can no longer preview the form.  A message box pops up with the text "InfoPath cannot open the selected form" and the only option available is "OK" - there are no additional details to view (other than the link "Was this information helpful?" :P)  I tried publishing the form to see if I could get a more meaningful message.  (Note - when I published it I did not web enable it)  I did get a different message opening it in SharePoint, it's not anymore meaningful to me, but any incites would be appreciated.  "InfoPath cannot create a new, blank form.  There was an error in the custom validation code."  When I click on Show Details it displays "Duplicate attribute".

     If I remove the data connection the problem does not go away, however I know that it is the data connection that is causing the problem because I have a copy of the form prior to adding the data connection.  When I test it without the data connection it works.  As soon as I add the data connection it stops working.  I have tried paring down the transform.xsl to almost nothing in case there is something in there that is breaking things.   But it still breaks the form.

     Here is my current incarnation of transform.xsl (I know it won't do anything useful, but I was hoping to narrow it down to find the breaking point):

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" />
      <xsl:template match="/">
       
      </xsl:template>
    </xsl:stylesheet>

     Has anyone seen this before?

    Thanks!

  • 03-10-2009 10:08 PM In reply to

    Re: Duplicate Attribute when adding a new data connection

    I haven't tested this solution in browser-enabled forms, which it sounds like you've created. There have been issues reported with the solution, but I've never been able to reproduce them. Perhaps if you provide some more information on how you created the form, I could try to reproduce the issue. As a last resort, you could try one of the other InfoPath to Word conversions I wrote about in this post: InfoPath to DOCX - An alternative to using XSLT for conversion.
  • 03-11-2009 02:02 PM In reply to

    • Kwirk
    • Not Ranked
    • Joined on 03-10-2009
    • Posts 9

    Re: Duplicate Attribute when adding a new data connection

     Thanks for the speedy reply!  The form is not currently browser enabled.  I have checked off "Design a form template that can be opened in a browser or InfoPath", but I have not published it as browser enabled - that is something that I might be doing down the line.  For the time being the form is only being used in the InfoPath client.   I created the InfoPath form from scratch in the designer view of InfoPath a few months ago.  The working version of the form has 6 data connections, 4 of which are retrieving information from a web server, 1 of which is a submit to a web service and the last (which is not in use) is an email submit.  There is some code behind on the form that populates the form with the values returned by one of the data connections.  (There are just too many fields to populate using InfoPath clicky-logic).

     As for the word document.  I started out with a word document that someone else had created for me. I added text to it to indicate where I wanted my fields to show up.  I saved the document, copied it and renamed it to be a .zip file.  I copied out the document.xml file and renamed it to transform.xsl.  I opened the file in Visual Studio 2005 and made the modifications as described in your article and saved the file.  Then I created the data connection:  Tools --> Data Connections --> Add.  I selected "Create a new connection to:" and "Receive data".  I selected "XML document" browsed for my transorm.xsl (with All Files (*.*) selected).  I included it as a resource file and told it to automatically retrieve data.  After all that, I clicked on the preview button, that's when the problem I described in the first post started happening,  At that point I closed the InfoPath form without saving - I opened it again at.  (The last save had been just prior to adding the new data connection.)  I tried the preview button & there was no problem generating the InfoPath preview - I tried readding the data conneciton, following the same steps and clicked the preview button again - same problem. 

     I'm not sure how much detail would be useful, and this post is getting quite long, so I think I'll stop here.    

    I will take a look at the alternative InfoPath to DOCX.  But please if you have any ideas about what the problem could be, I would love to hear them.  I know your solution works - I already made one successful InfoPath to Word conversion following your article and that one went off without a hitch, so I'm at a loss as to what could be causing this problem.  The other form that I converted was quite similar to this one.

     Thanks again for replying - I really appreciate it!

  • 03-12-2009 01:09 AM In reply to

    Re: Duplicate Attribute when adding a new data connection

    Thanks for listing the steps you followed. As I've understood from your story, you added the data connection (without adding any code yet) and tried previewing the form? And this is when things broke? If this is the case, it definitely sounds as though there is an error in the XSL file. Judging from the error message of "duplicate attribute", you should check whether you pasted any attributes (steps 12 and 13 in the article) more than once under the xsl:stylesheet node. Also, open the XSL file in Internet Explorer and see whether you can view its contents correctly; this is a way to check whether the file contains any errors with tags and such. Another question: Do you have any validation or rules in the form template?
  • 03-12-2009 03:40 PM In reply to

    • Kwirk
    • Not Ranked
    • Joined on 03-10-2009
    • Posts 9

    Re: Duplicate Attribute when adding a new data connection

    You understood correctly, however I tried opening my XSL file in Internet Explorer and it was fine.  

    Your last question was spot on though - I checked and my InfoPath from did have some validation rules on it.  I removed some that were not really relevant anymore and tried adding my datasource and it didn't break!  Thank you very much!   Tomorrow I am going to try to complete the form - I'll let you know how it goes.

     Again, thank you very much for your help!  Much appreciated!

  • 03-12-2009 09:42 PM In reply to

    Re: Duplicate Attribute when adding a new data connection

    No worries. Glad you got a step further.
  • 03-13-2009 03:38 PM In reply to

    • Kwirk
    • Not Ranked
    • Joined on 03-10-2009
    • Posts 9

    Re: Duplicate Attribute when adding a new data connection

     Just keeping you updated - I'm still poking away at it.  Now it's generating the word document (thanks!!), but it's not populating any of the xsl data - it only displays the parts of the transform.xsl that are not part of an xsl tag.  I'm thinking that it's not recognizing the field names.  I tried adding a tag referencing a non-existent field (ie <xsl:value-of select="my:myFields/my:thisfielddoesnotexist" />) and it does the same thing - ignore it.  Ah well, there's always Monday

  • 03-24-2009 02:19 AM In reply to

    Re: Duplicate Attribute when adding a new data connection

    Sorry for the delay in responding; things have been hectic. Yes, it sounds like the XPath expressions to the fields are incorrect. But you may have already resolved this?
  • 03-26-2009 02:35 PM In reply to

    • Kwirk
    • Not Ranked
    • Joined on 03-10-2009
    • Posts 9

    Re: Duplicate Attribute when adding a new data connection

    No worries - I haven't had a chance to play with it much this week.  I've gotten a little side tracked.  I'm hoping to be able to poke at it a bit more next week.  Thanks for the follow-up!

  • 03-26-2009 04:53 PM In reply to

    Re: Duplicate Attribute when adding a new data connection

    OK. Just let me know if you need more help.
  • 07-10-2009 01:16 AM In reply to

    Re: Duplicate Attribute when adding a new data connection

    Hi,

     

    Im having the same troubles but i cant seem to resolve them. The same as OP im getting "Duplicate attribute" errors after i add the .xsl as a external datasource. I followed the same steps as the OP "I created the data connection:  Tools --> Data Connections --> Add.  I selected "Create a new connection to:" and "Receive data".  I selected "XML document" - it finds the XSL if i open the xsl inside IE it gives 0 errors. However after i add this data con - every function field i check gives a exception with - duplicate attribute - detected. If i remove the data connection it still gives me the error. However if i restart infopath after deleting the dataconection and try again everything is back to normal.

    Did anybody find a solution for this or some hint to why it would be hapening? I checked my xsl inside a xml validator but it seems just fine.

     Gr, Vince

     

    :EDIT:

     

    right stripped the xsl to its barest minimumas shown below but it gives the same error. if i do this without the xsl things and call it xml i get no error. slowly getting a headague here :P

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     
    <xsl:output method="xml" />
        <note>
          <to>Tove</to>
          <from>Jani</from>
          <heading>Reminder</heading>
          <body>Don't forget me this weekend!</body>
        </note>
    </xsl:stylesheet>  

  • 07-10-2009 03:24 AM In reply to

    Re: Duplicate Attribute when adding a new data connection

    Did you try the same XSL with a different form template? Also, do you have anything in your form template that you aren't using anymore? How about data validations? Rules? Instead of stripping the XSL, you could try starting with a plain form and add your controls and validation from there and see where it breaks.
  • 07-10-2009 04:38 AM In reply to

    Re: Duplicate Attribute when adding a new data connection

     i havent tried it with another template, il try that now - i did check all the rules and validations - there are 0 validations and 1rule with alot off subt stuff init. Problem is what that thing does is nescesery for the functioning of the form.Anyway il give it a try with a stripped template quickly and post the response here.

  • 07-10-2009 04:42 AM In reply to

    Re: Duplicate Attribute when adding a new data connection

    Duplicate attribute.

     

    done with a clean template form without anything in it - only made 1 text area after i created the datalink to the xsl - then tried to put a function in it but gave the standard above msg.

     

     

    EDIT: So got some more info - it seems it has something to do with the <xsl:   main node- if i remove this it removes the errors. A colluege speculated that because its a existing system we are working on there might be a existing config file for working with xml/xsl witch adds the <xsl: node thus resolving in the duplicate attribute error.  It would then explain why most of the people i found with this problem are people working on existing workspaces with large systems. Il see if i can find the config file to verrify this tho.

  • 07-10-2009 03:06 PM In reply to

    Re: Duplicate Attribute when adding a new data connection

    OK. If you're still having issues after your investigations, send me a private message (click on my name and go to my profile page) with your email address and I'll send you an email address you can send your form template and the XSL to. Then I can have a look into it for you when I get a chance.
Page 1 of 2 (16 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.