XSLT: generate multiple object by incrementing attribute and value

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2010-06-02T16:45:50Z Indexed on 2010/06/02 17:04 UTC
Read the original article Hit count: 252

Filed under:
|
|

Hi, I have a xml as below that I'd like to copy n times while incrementing one of its element and one of its attribute.

XML input:

<Person position=1>
<name>John</name>
<number>1</number>
<number>1</number>
</Person>

and I'd like something like below with the number of increment to be a variable.

XML output:

<Person position=1>
<name>John</name>
<number>1</number>
</Person>
<Person position=2>
<name>John</name>
<number>2</number>
</Person>
....
<Person position=n>
<name>John</name>
<number>n</number>
</Person>

Any clue

© Stack Overflow or respective owner

Related posts about xslt

Related posts about loop