not sure if this is possible without having to go through several passes, but I\'ll ask anyway (my XSL is a little rusty)
I have an XML document, which contains node
This transformation:
struct
{
};
when applied on the provided XML document:
produces the wanted, correct result:
struct STRUCT_C
{
FIELD_E e;
FIELD_F f;
FIELD_G g;
};
struct STRUCT_B
{
STRUCT_C c;
FIELD_E e;
};
struct STRUCT_A
{
STRUCT_B b;
STRUCT_C c;
FIELD_D d;
};
Explanation:
structure elements are processed strictly one by one. At any time we process the first structure element whose id isn't yet registered in the pVisited parameter and that has no field/@idref value that isn't already in the pVisited parameter and refers to an existing structure element.