• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Formatting input XML and showing output XML

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to read and format a XML data. I am reading the data using XSLT. I am facing some issue in that. Could someone help me on this.

I have an XML input where I have only 1 parent node and the rest of XML hierarchy is a flat hierarchy.



Here Name node is mandatory node and rest are optional nodes. My requirement is if any optional node is not present in the input XML then I'll create a blank node for it.

but code is failing in the below scenario where I do not have <Salary> node for first employee.



The code I have written is


This is working fine when all the data are coming in the input but in the mentioned scenario its giving output like below



Its creating blank node for wrong employee.

Please let me know if you want any other information

thank you very much in advance.

Kaushik



 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good, you seem to know the biz. So I can show you, without waffle, how it can be done, applicable generically to a whole set of problems of the kind.

Now it calls a named template proc written like this.

That's all.
 
I will suppress my every urge. But not this shameless plug:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic