Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

XSL import of XML missing child node

Featured Replies

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 by Guest

  • Author

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 by Guest

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.

  • Author

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 by Guest

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:


	

         		

	

	   

	

	    

	



  • Author

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 by Guest

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 by Guest

  • Author

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 by Guest

  • Author

Edited for the new...I threw in a little.




	

	    

    		

		       

			      none

		       

   	           

		

 	

Edited by Guest

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.