chriswallis
Programmer
Can anyone tell me how to create the Destination document from the Source document listed below with XSLT? I have tried all kinds of combinations of variables and multi passes throught he document but cannot get it to work. Essentially I am trying to build a hierarchical document from a denormalized document.
Source:
<?xml version="1.0"?>
<xml>
<row Group='Group1' Form='Tablet' Strength='25Mg'/>
<row Group='Group1' Form='Tablet' Strength='50Mg'/>
<row Group='Group2' Form='Rotadisk' Strength='125Mg'/>
<row Group='Group2' Form='Rotadisk' Strength='250Mg'/>
<row Group='Group2' Form='Device' Strength='125Mg'/>
</xml>
Destination:
<?xml version="1.0"?>
<xml>
<Group>
<Description>Group1</Description>
<Form>
<Description>Tablet</Description>
<Strength>
<Description>25Mg</Description>
</Strength>
<Strength>
<Description>50Mg</Description>
</Strength>
</Form>
</Group>
<Group>
<Description>Group2</Description>
<Form>
<Description>Rotadisk</Description>
<Strength>
<Description>125Mg</Description>
</Strength>
<Strength>
<Description>250Mg</Description>
</Strength>
</Form>
<Form>
<Description>Device</Description>
<Strength>
<Description>125Mg</Description>
</Strength>
</Form>
</Group>
</xml>
Source:
<?xml version="1.0"?>
<xml>
<row Group='Group1' Form='Tablet' Strength='25Mg'/>
<row Group='Group1' Form='Tablet' Strength='50Mg'/>
<row Group='Group2' Form='Rotadisk' Strength='125Mg'/>
<row Group='Group2' Form='Rotadisk' Strength='250Mg'/>
<row Group='Group2' Form='Device' Strength='125Mg'/>
</xml>
Destination:
<?xml version="1.0"?>
<xml>
<Group>
<Description>Group1</Description>
<Form>
<Description>Tablet</Description>
<Strength>
<Description>25Mg</Description>
</Strength>
<Strength>
<Description>50Mg</Description>
</Strength>
</Form>
</Group>
<Group>
<Description>Group2</Description>
<Form>
<Description>Rotadisk</Description>
<Strength>
<Description>125Mg</Description>
</Strength>
<Strength>
<Description>250Mg</Description>
</Strength>
</Form>
<Form>
<Description>Device</Description>
<Strength>
<Description>125Mg</Description>
</Strength>
</Form>
</Group>
</xml>