Hi,
I am trying to convert the XML below:
<?xml version="1.0" encoding="utf-8" ?>
- <string xmlns="- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <datareader>
- <_x0031_088 diffgr:id="10881" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate />
<ActionUser>72</ActionUser>
<ActionNarrative />
<ActionTypeID>15</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10882" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-13T17:53:31.85+01:00</ActionDate>
<ActionUser>72</ActionUser>
<ActionNarrative>Lead reallocated by to</ActionNarrative>
<ActionTypeID>16</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10883" msdata:rowOrder="2" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-14T08:35:22+01:00</ActionDate>
<ActionUser>88</ActionUser>
<ActionNarrative>Couldnt get put through. Have left detailed message and will call back if intereste</ActionNarrative>
<ActionTypeID>1</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10884" msdata:rowOrder="3" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-21T08:20:44.533+01:00</ActionDate>
<ActionUser>72</ActionUser>
<ActionNarrative>Lead re-allocated by Dawn Jeffries to</ActionNarrative>
<ActionTypeID>16</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10885" msdata:rowOrder="4" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-26T14:02:54.84+01:00</ActionDate>
<ActionUser>72</ActionUser>
<ActionNarrative>Lead re-allocated by Dawn Jeffries to Rosemary Glave</ActionNarrative>
<ActionTypeID>16</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10886" msdata:rowOrder="5" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>18532</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Mark Booth</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>30/Apr/2004 00:00:00</Due_Date>
<Priority>2</Priority>
<Status>A</Status>
<Event_Name>KnowledgeBox Pipeline Prospect</Event_Name>
<ActionDate>2003-11-17T00:00:00+00:00</ActionDate>
<ActionUser>21</ActionUser>
<ActionNarrative>Last demo:17-Nov-03</ActionNarrative>
<ActionTypeID>21</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10887" msdata:rowOrder="6" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>37040</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>28</Type_ID>
<Sub_Type>A: Marketing Activity - Completed</Sub_Type>
<UserName1>Alex Wilkinson</UserName1>
<Status>F</Status>
<Event_Name>Summer Term Offer</Event_Name>
<ActionDate>2004-06-18T00:00:00+01:00</ActionDate>
<ActionUser>53</ActionUser>
<ActionTypeID>9</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10888" msdata:rowOrder="7" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>78466</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>28</Type_ID>
<Sub_Type>A: Marketing Activity - Completed</Sub_Type>
<UserName1>Jo Dieguez</UserName1>
<Status>F</Status>
<Event_Name>MathsWorks Teaser ED05-100a/b/c</Event_Name>
<ActionDate>2005-04-15T00:00:00+01:00</ActionDate>
<ActionUser>54</ActionUser>
<ActionTypeID>9</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10889" msdata:rowOrder="8" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>86646</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>28</Type_ID>
<Sub_Type>A: Marketing Activity - Completed</Sub_Type>
<UserName1>Penelope Beech</UserName1>
<Status>F</Status>
<Event_Name>Digitexts April Offer Campaign 05</Event_Name>
<ActionDate>2005-04-19T00:00:00+01:00</ActionDate>
<ActionUser>55</ActionUser>
<ActionTypeID>9</ActionTypeID>
</_x0031_088>
</datareader>
</diffgr:diffgram>
</string>
To one of this format..
<WS1088>
<WS1088_Result diffgr:id="WS1088_Result1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<uname>spirit_sys</uname>
<password>Gh05t5ly</password>
</WS1088_Result>
<WS1088_Results diffgr:id="WS1088_Results1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<Event_ID>35375</Event_ID>
<Spirit_ID>32949</Spirit_ID>
<KB_ID>1378</KB_ID>
<EstablishmentName>Selsdon Primary School</EstablishmentName>
<Postcode>CR2 8LQ</Postcode>
<StatusID>28</StatusID>
<Sub_TypeID>A: Marketing Activity Completed</Sub_TypeID>
<UserName>spirit_sys</UserName>
<StartDate>18/Jun/2004 00:00:00</StartDate>
<Due_Date>29/Aug/2006 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>Summer Term Offer</Event_Name>
<CallHistory>
<Call>
<DateTime>29/Aug/2006 00:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>Checked - they want it all.</Note>
</Call>
</CallHistory>
</WS1088_Results>
<WS1088_Results diffgr:id="WS1088_Results2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<Event_ID>53389</Event_ID>
<Spirit_ID>32949</Spirit_ID>
<KB_ID>1378</KB_ID>
<EstablishmentName>Selsdon Primary School</EstablishmentName>
<Postcode>CR2 8LQ</Postcode>
<StatusID>13</StatusID>
<Sub_TypeID>A: Closed Sale Made</Sub_TypeID>
<UserName>spirit_sys</UserName>
<StartDate>14/Feb/2005 12:00:00</StartDate>
<Due_Date>14/Sep/2005 12:00:00</Due_Date>
<Status>F</Status>
<Event_Name>lead from BETT</Event_Name>
<CallHistory>
<Call>
<DateTime>14/Sep/2005 12:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>left msg regarding upgrade - yet again</Note>
</Call>
<Call>
<DateTime>12/Sep/2005 12:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>left msg regarding upgrade - again</Note>
</Call>
<Call>
<DateTime>10/Sep/2005 12:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>left msg regarding upgrade</Note>
</Call>
</CallHistory>
</WS1088_Results>
...
</WS1088>
</diffgr:diffgram>
</string>
Basically the EVENT_ID element forms a group, then there is a loop within the group.
I have spent ages trying to write the XSLT for this and it is driving me mad. Any help would be appreciated.
I am trying to convert the XML below:
<?xml version="1.0" encoding="utf-8" ?>
- <string xmlns="- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <datareader>
- <_x0031_088 diffgr:id="10881" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate />
<ActionUser>72</ActionUser>
<ActionNarrative />
<ActionTypeID>15</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10882" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-13T17:53:31.85+01:00</ActionDate>
<ActionUser>72</ActionUser>
<ActionNarrative>Lead reallocated by to</ActionNarrative>
<ActionTypeID>16</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10883" msdata:rowOrder="2" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-14T08:35:22+01:00</ActionDate>
<ActionUser>88</ActionUser>
<ActionNarrative>Couldnt get put through. Have left detailed message and will call back if intereste</ActionNarrative>
<ActionTypeID>1</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10884" msdata:rowOrder="3" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-21T08:20:44.533+01:00</ActionDate>
<ActionUser>72</ActionUser>
<ActionNarrative>Lead re-allocated by Dawn Jeffries to</ActionNarrative>
<ActionTypeID>16</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10885" msdata:rowOrder="4" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>17791</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>20</Type_ID>
<Sub_Type>A: Closed - No Sale</Sub_Type>
<UserName1>Rosemary Glave</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>25/May/2004 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>KB PROSPECT</Event_Name>
<ActionDate>2004-05-26T14:02:54.84+01:00</ActionDate>
<ActionUser>72</ActionUser>
<ActionNarrative>Lead re-allocated by Dawn Jeffries to Rosemary Glave</ActionNarrative>
<ActionTypeID>16</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10886" msdata:rowOrder="5" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>18532</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Mark Booth</UserName1>
<StartDate>13/May/2004 00:00:00</StartDate>
<Due_Date>30/Apr/2004 00:00:00</Due_Date>
<Priority>2</Priority>
<Status>A</Status>
<Event_Name>KnowledgeBox Pipeline Prospect</Event_Name>
<ActionDate>2003-11-17T00:00:00+00:00</ActionDate>
<ActionUser>21</ActionUser>
<ActionNarrative>Last demo:17-Nov-03</ActionNarrative>
<ActionTypeID>21</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10887" msdata:rowOrder="6" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>37040</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>28</Type_ID>
<Sub_Type>A: Marketing Activity - Completed</Sub_Type>
<UserName1>Alex Wilkinson</UserName1>
<Status>F</Status>
<Event_Name>Summer Term Offer</Event_Name>
<ActionDate>2004-06-18T00:00:00+01:00</ActionDate>
<ActionUser>53</ActionUser>
<ActionTypeID>9</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10888" msdata:rowOrder="7" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>78466</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>28</Type_ID>
<Sub_Type>A: Marketing Activity - Completed</Sub_Type>
<UserName1>Jo Dieguez</UserName1>
<Status>F</Status>
<Event_Name>MathsWorks Teaser ED05-100a/b/c</Event_Name>
<ActionDate>2005-04-15T00:00:00+01:00</ActionDate>
<ActionUser>54</ActionUser>
<ActionTypeID>9</ActionTypeID>
</_x0031_088>
- <_x0031_088 diffgr:id="10889" msdata:rowOrder="8" diffgr:hasChanges="inserted">
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
<Event_ID>86646</Event_ID>
<Spirit_ID>36212</Spirit_ID>
<EstablishmentFullName>Ley Top Primary School</EstablishmentFullName>
<Postcode>BD15 7PQ</Postcode>
<Type_ID>28</Type_ID>
<Sub_Type>A: Marketing Activity - Completed</Sub_Type>
<UserName1>Penelope Beech</UserName1>
<Status>F</Status>
<Event_Name>Digitexts April Offer Campaign 05</Event_Name>
<ActionDate>2005-04-19T00:00:00+01:00</ActionDate>
<ActionUser>55</ActionUser>
<ActionTypeID>9</ActionTypeID>
</_x0031_088>
</datareader>
</diffgr:diffgram>
</string>
To one of this format..
<WS1088>
<WS1088_Result diffgr:id="WS1088_Result1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<uname>spirit_sys</uname>
<password>Gh05t5ly</password>
</WS1088_Result>
<WS1088_Results diffgr:id="WS1088_Results1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<Event_ID>35375</Event_ID>
<Spirit_ID>32949</Spirit_ID>
<KB_ID>1378</KB_ID>
<EstablishmentName>Selsdon Primary School</EstablishmentName>
<Postcode>CR2 8LQ</Postcode>
<StatusID>28</StatusID>
<Sub_TypeID>A: Marketing Activity Completed</Sub_TypeID>
<UserName>spirit_sys</UserName>
<StartDate>18/Jun/2004 00:00:00</StartDate>
<Due_Date>29/Aug/2006 00:00:00</Due_Date>
<Status>F</Status>
<Event_Name>Summer Term Offer</Event_Name>
<CallHistory>
<Call>
<DateTime>29/Aug/2006 00:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>Checked - they want it all.</Note>
</Call>
</CallHistory>
</WS1088_Results>
<WS1088_Results diffgr:id="WS1088_Results2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
<Event_ID>53389</Event_ID>
<Spirit_ID>32949</Spirit_ID>
<KB_ID>1378</KB_ID>
<EstablishmentName>Selsdon Primary School</EstablishmentName>
<Postcode>CR2 8LQ</Postcode>
<StatusID>13</StatusID>
<Sub_TypeID>A: Closed Sale Made</Sub_TypeID>
<UserName>spirit_sys</UserName>
<StartDate>14/Feb/2005 12:00:00</StartDate>
<Due_Date>14/Sep/2005 12:00:00</Due_Date>
<Status>F</Status>
<Event_Name>lead from BETT</Event_Name>
<CallHistory>
<Call>
<DateTime>14/Sep/2005 12:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>left msg regarding upgrade - yet again</Note>
</Call>
<Call>
<DateTime>12/Sep/2005 12:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>left msg regarding upgrade - again</Note>
</Call>
<Call>
<DateTime>10/Sep/2005 12:00:00</DateTime>
<User>Shelley Stanton</User>
<Action>Telephone Call Out Bound</Action>
<Note>left msg regarding upgrade</Note>
</Call>
</CallHistory>
</WS1088_Results>
...
</WS1088>
</diffgr:diffgram>
</string>
Basically the EVENT_ID element forms a group, then there is a loop within the group.
I have spent ages trying to write the XSLT for this and it is driving me mad. Any help would be appreciated.