Transform - anyone have a nested (people) XSLT example? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Transform - anyone have a nested (people) XSLT example?

Last post 06-09-2016 04:30 AM by theportalshop. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 06-08-2016 10:18 AM

    Transform - anyone have a nested (people) XSLT example?

    Hey there Infopath pals, Anyone happen to have an XSLT example transforming people(with its 3 nodes) from a secondary DS to an internal(to the form) repeating table person field group? I'm working on my transform file now and have already had great success with it with "flat" structures thanks to Jimmy's very helpful webinar video. But in the end of that video he did mention that this was likely possible. I may get lucky and get there by myself and if I do I'll post an example if anyone needs it, but was hoping that maybe one of you qGeniuses have done this and wouldn't mind giving this loyal qRules customer a little nudge in the right direction... :) Thanks so much for reading, Bill
  • 06-08-2016 11:32 AM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    Hi Bill!

    Glad to hear you enjoyed the video.

    Could you provide a screen shot of both the secondary data source the values are coming from and the format you want to change it into? And if you can attach whatever you've got so far for the XSLT file, I can help point you in the right direction.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-08-2016 01:55 PM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    Hey Jimmy, thanks for replying. Here is where I am, and actually I’m just about to try it in the form. It’s taken me a while to get this together today, and after posting this here to you I’m just going to give it a try as-is, but it probably needs some correcting. Below is the XSLT I came up with for this project and attached images of the secondary DS and the repeating destination table. Note: You will notice I am attempting to set values a few data fields from the myFields level of the form as well. I may have made an error there and if so I’ll get that corrected after I test it (e.g. ../../../my:Period) Regardless, the real question is how to properly handle transforming into the people/person field (called “Assignees” in this case). Also, do you think I need to include a namespace declaration for the Person field? Perhaps like: xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" Thank you for whatever insight you can share! Again, thanks for the video and the help, Bill
  • 06-08-2016 01:57 PM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    Seems like parts of the post were omitted when I posted this, so I will reply with XSLT as an attachment and the second picture. might not have liked that xslt pasted inline maybe. -Bill
  • 06-08-2016 01:59 PM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    Part 2 of 3 attached is Source DS image
  • 06-08-2016 02:01 PM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    part 3 of 3 XSLT attached hope this works! thank you again, Bill
  • 06-08-2016 02:34 PM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    qRules gave an error on line 26 of the XSLT, which happens to be the open tag for the repeating person section. Didn't like the "/" so obviously I represented that whole thing incorrectly as I kinda expected. :) The full error: Action: Transform. Arguments: sourceds: Users destpath: /my:myFields/my:UserSchedules xsltfile: UserTransfer.xslt placement: append . Details: '/' is an unexpected token. The expected token is '>'. Line 26, position 20.. Stack: at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.Load(Stream inStream) at Qdabra.Tools.RulesLibrary.Transform.LoadTransform(String fileName, Boolean isView, Boolean useDocument, Commands commands) at Qdabra.Tools.RulesLibrary.Transform.GetTransform(String fileName, Commands commands, LoadTransformOptions options, Boolean useCache) at Qdabra.Tools.RulesLibrary.Transform.Execute() at Qdabra.Tools.RulesLibrary.CommandStarter.Run() at Qdabra.Tools.RulesLibrary.Commands.RunCommand(Commands command) at Qdabra.Tools.RulesLibrary.Commands.ExecuteCommand()
  • 06-08-2016 02:59 PM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    I'm sorry for all of the posts, and this will be last for today unless I get it working. Thanks again for taking a look. I've attached my latest changes as a text file so we don't lose formatting in the forum and hopefully this is easier to read.
  • 06-09-2016 01:39 AM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    Hi Bill,

    Thanks for all the detail. Looks like you were on the right track.

    I think the attached XSLT should work, and you can run it like this:

        Transform /sourceds=Users /destpath=/my:myFields/my:UserSchedules /xsltfile=UserTransfer.xslt /placement=append /excluderoot=true

    Some pointers about where you went wrong:

    • It looks like you were trying to put the people values into a <my:UserSchedules> group, but you needed to put it into my:Assignees. You also needed to have a <pc:Person> group inside that. I think you were getting a schema validation error because you didn't use the /excluderoot parameter, but this would have also caused a schema validation error.
    • The approach you were using only would have copied at most one person. You needed to iterate over the multiple people either using another <xsl:apply-templates> or an <xsl:for-each>
      • Luckily, people fields are a special case because they have the same structure in both the source and destination, so we can use a single <xsl:copy-of> line to copy them.
    • The XPaths you were using to copy the schedule, period, and year wouldn't have worked because they would have been in relation to the d:SharePointListItem_RW group, not the main data source. While it is possible to populate these values using the XSLT, it would be easier to use an ordinary Set a field's value rule to copy values into these fields after the Transform, or just remove those fields altogether. If there are already fields in the form storing those values you probably don't need to have a copy of them in each row of your repeating group. (Please let me know if you have a situation where these options wouldn't work.)
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-09-2016 04:30 AM In reply to

    Re: Transform - anyone have a nested (people) XSLT example?

    Jimmy, thank you so much. Great job on this - you noticed and corrected all of my own errors and even simply explained the people fields too. And, the XSLT you provided worked perfectly! Again, I so very much appreciate your video and your help and explanation here. You and the rest of the qdabra team are the best! Have a great day! Bill
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.