Using XSLT 1.0 - I have the following xml and I an trying to perform the following
- Group By the first Field where id="1923" if the value attribute is the same
- and average all the fields with id="3095" using the value attribute
- and average all the fields with id="3095" using the value attribute
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Trans.xsl"?>
<Results>
<List count="6">
<Record contentId="1017835" finalFlag="True" levelId="" moduleId="152" primarySortId="" secondarySortId="" parentId="0" row="1" parentRow="" >
<Field id="1923" type="1" value="Test 1"></Field>
<Field id="3095" type="4" valueID="3809" value="1" parentId="3809" parentName="5" ></Field>
<Field id="3096" type="4" valueID="3809" value="1" parentId="3809" parentName="5" ></Field>
</Record>
<Record contentId="1017828" finalFlag="True" levelId="" moduleId="152" primarySortId="" secondarySortId="" parentId="0" row="2" parentRow="" >
<Field id="1923" type="1" value="Test 2"></Field>
<Field id="3095" type="4" valueID="729" value="2" parentId="729" parentName="2" ></Field>
<Field id="3096" type="4" valueID="3809" value="5" parentId="3809" parentName="5" ></Field>
</Record>
<Record contentId="1017978" finalFlag="True" levelId="" moduleId="152" primarySortId="" secondarySortId="" parentId="0" row="3" parentRow="" >
<Field id="1923" type="1" value="Test 3"></Field>
<Field id="3095" type="4" valueID="3808" value="4" parentId="3808" parentName="4" ></Field>
<Field id="3096" type="4" valueID="3808" value="4" parentId="3808" parentName="4" ></Field>
</Record>
<Record contentId="1035463" finalFlag="True" levelId="" moduleId="152" primarySortId="" secondarySortId="" parentId="0" row="4" parentRow="" >
<Field id="1923" type="1" value="Test 2"></Field>
<Field id="3095" type="4" valueID="3808" value="4" parentId="3808" parentName="4" ></Field>
<Field id="3096" type="4" valueID="730" value="3" parentId="730" parentName="3" ></Field>
</Record>
<Record contentId="1017985" finalFlag="True" levelId="" moduleId="152" primarySortId="" secondarySortId="" parentId="0" row="5" parentRow="" >
<Field id="1923" type="1" value="Test 1"></Field>
<Field id="3095" type="4" valueID="113690" value="10" parentId="113690" parentName="10" ></Field>
<Field id="3096" type="4" valueID="113690" value="10" parentId="113690" parentName="10" ></Field>
</Record>
<Record contentId="1017835" finalFlag="True" levelId="" moduleId="152" primarySortId="" secondarySortId="" parentId="0" row="6" parentRow="" >
<Field id="1923" type="1" value="Test 1"></Field>
<Field id="3095" type="4" valueID="3809" value="5" parentId="3809" parentName="5" ></Field>
<Field id="3096" type="4" valueID="3809" value="5" parentId="3809" parentName="5" ></Field>
</Record>
</List>
</Results>
Trying to produce the following using trans.xsl:
<Records>
<Data>
<Text1923>Test 1</Text1923>
<Avg3095>5.33</Avg3095>
<Avg3096>5.33</Avg3096>
</Data>
<Data>
<Text1923>Test 2</Text1923>
<Avg3095>3</Avg3095>
<Avg3096>4</Avg3096>
</Data>
<Data>
<Text1923>Test 3</Text1923>
<Avg3095>4</Avg3095>
<Avg3096>4</Avg3096>
</Data>
</Records>