Actually the structure is OK, it's the repetitions that are causing me problems. What I've got for source data is data that was originally header-detail but got flattened when exported to XML.
root
hd1 1 /hd1
hd2 A /hd2
ln1 10 /ln1
ln2 10A /ln2
/root
root
hd1 1 /hd1
hd2 A /hd2
ln1 20 /ln1
ln2 1A /ln2
/root
root
hd1 2 /hd1
hd2 B /hd2
ln1 10 /ln1
ln2 2A /ln2
/root
Note that the first two roots have the same h1 and h2 data.
What I need is something like:
root
hd
hd1 1 /hd1
hd2 A /hd2
/hd
ln
ln1 10 /ln1
ln2 10A /ln2
/ln
ln
ln1 20 /ln1
ln2 1A /ln2
/ln
/root
root
hd
hd1 2 /hd1
hd2 B /hd2
hd
ln
ln1 10 /ln1
ln2 2A /ln2
ln
/root
But what I am getting is:
root
hd
hd1 1 /hd1
hd2 A /hd2
/hd
ln
ln1 10 /ln1
ln2 10A /ln2
/ln
/root
root
hd
hd1 1 /hd1
hd2 A /hd2
/hd
ln
ln1 20 /ln1
ln2 1A /ln2
/ln
/root
root
hd
hd1 2 /hd1
hd2 B /hd2
/hd
ln
ln1 10 /ln1
ln2 2A /ln2
/ln
/root
If there was a xsl:for-each-unique select="root/h1" available, that might work, but that doesn't exist.
Any help would be appreciated.
Thanks
Doug