• 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

XSLT : appending node number

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I need xslt code which converts input.xml to output.xml
Here is my input and output xml files looks as follows.

input.xml:

<test>
<Students action="create">
<student>john</student>
<student>kelly</student>
<student>peter</student>
</Students>
</test>

output.xml:-

<test>
<name>Students</name>
<value>create</value>
<name>student[1]</name><!-- 1, 2, 3...are to be appended becoz no of 'student' appears in input xml -->
<value>john</value>
<name>student[2]</name>
<value>kelly</value>
<name>student[3]</name>
<value>peter</value>
</test>

Thanks in advance,

-jagdish
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic