It's failing on 3rd condition and I'm not able to understand why. I tried running the code on my local machine with dummy data, and it seems to produce the correct output. I'm clearly removing the template class and style attribute from the copy of element having the template class, Line 24-27