Hi
I wonder if somebody can help me flatten an XML file to CSV format. I have worked on this all day today, and although I've found some simple examples, my issue is slighlty different. Please see example below...
Example XML:
<data>
<val_A>1</val_A>
<val_A>2</val_A>
<val_B>3</val_B>
<val_B>4</val_B>
<val_C>
<val_D>5</val_D>
<val_D>6</val_D>
</val_C>
<val_E>
<val_F>7</val_F>
<val_F>8</val_F>
</val_E>
</data>
Expected Output:
val_A,val_B,val_C,val_D,val_E,val_F
1,3,,5,,7
1,3,,5,,8
1,3,,6,,7
1,3,,6,,8
1,4,,5,,7
1,4,,5,,8
1,4,,6,,7
1,4,,6,,8
2,3,,5,,7
2,3,,5,,8
2,3,,6,,7
2,3,,6,,8
2,4,,5,,7
2,4,,5,,8
2,4,,6,,7
2,4,,6,,8
Notice that the data node has several different structure of child node. Is it possible to write XSL to flatten this?
Second question is it possible to write the XSL in a generic way so that it doesn't need to be aware of node names and therefore just works for any XML fed in?
Any help would be greatly appreciated.
Thanks David