File: Data.xml
First Chapter
Second Chapter
Subchapter 1
Subchapter 2
Third Chapter
Subchapter A
Subchapter B
sub a
sub b
Subchapter C
File: Transform.xslt
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Number
text
Output:
Number text I: First Chapter II:
Second Chapter
II-1: Subchapter 1 II-2: Subchapter 2 III:
Third Chapter
III-1: Subchapter A III-2:
Subchapter B
III-2-a: sub a III-2-b: sub b III-3: Subchapter C