Cabinetman Posted October 3, 2007 Posted October 3, 2007 (edited) I thought I'd start fresh on this part... I am importing data via XML into my database. Here's what I have: 1 record with several items of data importing using my XSL Stylesheet. Repeating data into separate fields... Simplified example of XML data nodes: Data coming into each field: ItemName,DatePurchased, LastSaleDate, Cost, ListPrice, shelf1, 1/1/2007, 2/2/2007 ,$10.00,$20.00 shelf2, 1/1/2007,(Empty so no node present),$10.00,$17.50 shelf3, 1/1/2007, 2/2/2007 ,$10.00,$20.00 But it looks like: Field1 field2 field3 field4 field5 shelf1, 1/1/2007 2/2/2007 $10.00 $20.00 shelf2, 1/1/2007 2/2/2007 $10.00 $17.50 shelf3, 1/1/2007 (moved up) $10.00 $20.00 The data below the missing child node moves up in the field. I'm using and as such... You get the idea....... In my mind I see something like: Edited Wed. PM ... or something.... I just don't know. Help would be greatly appreciated! Edited October 3, 2007 by Guest
Cabinetman Posted October 4, 2007 Author Posted October 4, 2007 (edited) Thursday PM I'm getting closer... Almost There! I do get what appears to be a carriage return in between. However Items 1 and 4 have a LastSaleDate and 2 and 3 don't. Upon import ItemName3 lines up with the LastSaleDate of #4..... Oh so much closer, I think. SSSSooooooo I need to figure out how to tell it - for every instance that LastSaleDate doesn't exist under each item - to put in the return...... Edited October 4, 2007 by Guest
Fenton Posted October 4, 2007 Posted October 4, 2007 You need to decide on 1 field, the one that ALWAYS has data, to use for the . Then you get the other data which is at the same position in the other relevant nodes. You do not use for-each for each of the nodes; unless, like you got, you don't care whether they line up. So, you get the 1st item name, you capture its position into a variable, then use that to get the 1st date purchased, etc.. That way it lines up, blanks remain blanks. I will show you how to do it if you post the real xml. The xml example you posted is not real and has no data, hence it is not usable for transformaton, and I don't really want to spend time adding it. So post that first bit of xml again, but with the end tags, and with the data in it.
Cabinetman Posted October 5, 2007 Author Posted October 5, 2007 (edited) I was really trying NOT to bother you on this one. I even posted on another forum without much luck. I've read countless web pages and examples. My head is spinning! Anyway if you don't care to help here are the 2 ACTUAL files I'm using. The XSL and the XML as they are for my purpuse. Thanks PS: Since I've had no training on this... is my terminology right? search_poss_asins_fmp.zip Edited October 5, 2007 by Guest
Fenton Posted October 5, 2007 Posted October 5, 2007 Short answer. That's not the right xml for the xsl file, one is LookupResponse, the other is SearchResponse. Secondly, you need to read up on how to use Choose, or If. I don't even know that you need them. But even if you did I doubt you need both. In any case, this is how Choose is used:
Cabinetman Posted October 5, 2007 Author Posted October 5, 2007 (edited) My, what a #$!#$@# day I'm having. First the IRS hits me for $2000 and then I can't even upload the correct files. I think I have it right this time. Didn't read your response in full so I'll go over it now..... It may not have been on where I'm at at the moment. I LOVE fridays! search_poss_asins_fmp.zip Edited October 5, 2007 by Guest
Fenton Posted October 5, 2007 Posted October 5, 2007 (edited) It actually turns out to much simpler. Since what you really want is 1 (sales rank or not) plus a line, for each Item, it is easier to target the Item with the for-each. Then it gives you what you want: Edited October 5, 2007 by Guest
Cabinetman Posted October 5, 2007 Author Posted October 5, 2007 (edited) HUuummmmm. I'm throwing that in now. Edited: I knew it had to be something simple! Repeat after me............. "All Hail the Great Pooh-Bah","All Hail the Great Pooh-Bah","All Hail the Great Pooh-Bah" LOL! I'm gonna change the loaded files later to something everyone can use in case this comes up for them during a search.... UGH ! SSssooooo simple! Edited October 5, 2007 by Guest
Cabinetman Posted October 5, 2007 Author Posted October 5, 2007 (edited) Edited for the new...I threw in a little. none Edited October 5, 2007 by Guest
Recommended Posts
This topic is 6257 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now