Hello,
I have a question. I have the following source xml file:
Source xml:
<Container>
<DataHeader>
<c id="b" value="TAG" />
<c id="g" value="Info" />
</DataHeader>
<Data>
<Rows>
<r no="1">
<c id="b" value="uid1" uid="T.A.uid1" />
<c id="g" value="uid1|tag1|attr1|somevalue1" />
</r>
<r no="1">
<c id="b" value="uid1" uid="T.A.uid1" />
<c id="g" value="uid1|tag1|attr2|somevalue2" />
</r>
<r no="2">
<c id="b" value="uid1" uid="T.A.uid1" />
<c id="g" value="uid1|tag2|attr3|somevalue3" />
</r>
<r no="10">
<c id="b" value="uid2" uid="T.A.uid2" />
<c id="g" value="uid2|tag1|attr1|somevalue4" />
</r>
<r no="11">
<c id="b" value="uid2" uid="T.A.uid2" />
<c id="g" value="uid2|tag2|attr3|somevalue5" />
</r>
</Rows>
</Data>
</Container>
The element 'c' with id 'g' is important in the source xml. This is a concatened string which values are seperated by a '|'. We need this values to make the target xml. The element 'c' with id 'b' you can use to separate the 'uid'.
example and explantion of values:
<c id="g" value="uid1|tag1|attr1|somevalue1" />
**uid value** | element node | **attribute** | attribute value
**uid1** | tag1 | **attr1** |somevalue1
Al elements with the same 'uid' have to be aggregated into 1 single "TestTag" element (see target xml). Al attributes (attr1, attr2) with same parent element (for example 'tag1') needs to be added to 1 element. I only can make use of xslt(xpath) 1.0.
The target xml file should look like this after transforming.
Target xml after transformed by xsl:
<Container>
<TestTag>
<object UID="T.A.uid1" Name="uid1"/>
<tag1 attr1="somevalue1" attr2="somevalue2"/>
<tag2 attr3="*somevalue3"/>
</TestTag>
<TestTag>
<Iobject UID="T.A.uid2" Name="uid2"/>
<tag1 attr1="somevalue4" />
<tag2 attr3="somevalue5"/>
</TestTag>
</Container>
What are possible solutions for transforming source xml to target xml? I tried several things but I'm stuck right now.