Below is the xsl I have used for transforming an xml to a flat file, whci also satisfies various other required conditions.
This transformation:
"
HDR";"PIGLSSTD";"20120112045620";"F":
FTR;
when applied on the provided XML document:
Success
2012-01-03T17:05:04
7816
XML
49555
add
Active Personnel
People Status Global Term1
Global People Status Term1
PDA Term1
PDI Term1
GLB Term1
49556
EQ Term1
term name Term1
term vocabulary Term1
49557
BT
General Active Personnel
People Status Global Updated
49556
add
Leave of Absence Personnel
People Status Global Term2
GLB Term2
PDI Term2
BT
49554
General Non-Active Personnel Term2
People Status Global Term2
produces the wanted, correct result:
HDR";"PIGLSSTD";"20120112045620";"F":
"GL";"PDA Term1";"People Status Global Term1";"term vocabulary Term1";
"GL";"PDA Term1";"People Status Global Term1";"People Status Global Updated";
"GL";"PDA Term1";"Global People Status Term1";"term vocabulary Term1";
"GL";"PDA Term1";"Global People Status Term1";"People Status Global Updated";
"GL";"PDI Term1";"People Status Global Term1";"term vocabulary Term1";
"GL";"PDI Term1";"People Status Global Term1";"People Status Global Updated";
"GL";"PDI Term1";"Global People Status Term1";"term vocabulary Term1";
"GL";"PDI Term1";"Global People Status Term1";"People Status Global Updated";
"GL";"GLB Term1";"People Status Global Term1";"term vocabulary Term1";
"GL";"GLB Term1";"People Status Global Term1";"People Status Global Updated";
"GL";"GLB Term1";"Global People Status Term1";"term vocabulary Term1";
"GL";"GLB Term1";"Global People Status Term1";"People Status Global Updated";
"GL";"GLB Term2";"People Status Global Term2";"People Status Global Term2";
"GL";"PDI Term2";"People Status Global Term2";"People Status Global Term2";
FTR;14