View Single Post
  #4 (permalink)  
Old May 23rd, 2018, 10:30 AM
NagKrv NagKrv is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2018
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Martin,

Thanks for your reply.
I am using Xalan Java 2.7 & XSL Processor Version 1.1.
Yes the category level will be same every time in both xmls. The below are 4 level categories
root > master > sec > ch.
And the products comes under "ch" category. Category tree path with products looks as [root > master > sec > ch > products > p1,p2,..etc]. Here in both xmls the number of products may vary and may also contains same products. In both xmls the id's of each categories may or may not vary. I think we have to build a category tree path first and merge the products that comes under same category tree path after comparing both xmls. No duplicate products following duplicate categories should contain after merge.
For eg..,

root_id > master_id > sec_id > ch_id > products > (p1_id,p2_id...pn)
xml1:
root_123 > master_234 > sec_456 > ch_567 > products > p_1,p_2
root_123 > master_234 > sec_356 > ch_567 > products > p_5,p_6
root_234 > master_345 > sec_456 > ch_981 > products > p_3,p_4

xml2:
root_123 > master_234 > sec_456 > ch_567 > products > p_1,p_2,p_8
root_123 > master_234 > sec_356 > ch_569 > products > p_5,p_6,p_7
root_234 > master_345 > sec_456 > ch_981 > products > p_3,p_9

mergedxml:
1) root_123 > master_234 > sec_456 > ch_567 > products > p_1,p_2,p_8
2) root_123 > master_234 > sec_356 > ch_567 > products > p_5,p_6
3) root_123 > master_234 > sec_356 > ch_569> products > p_5,p_6,p_7
4) root_234 > master_345 > sec_456 > ch_981 > products > p_3,p_9,p_4

After merge
the line 1) category path gets more products
the line 2) gets two more "ch" categories under sec_356
the line 3) gets additional product p_7 from second xml
the line 4) gets additonal product p_9 from second xml

Please let me know if this example is good enough to understand the requirement.

We can ignore merging of <content> if the same category id exists in the both xmls. TIA!

Last edited by NagKrv; May 24th, 2018 at 12:08 AM..