S
Scott
The following is the XML I have to work with. Below is the question
<Table0>
<CaseID>102114</CaseID>
<CaseNumber>1</CaseNumber>
<DateOpened>2005-06-14T07:26:00.0000000-05:00</DateOpened>
<OnCallPerson />
<CallType>Exposure</CallType>
<ExposureReason>General</ExposureReason>
<OtherExposureReason>Unintentional</OtherExposureReason>
<ClientName>Test Client</ClientName>
<Priority>Medium</Priority>
<Table1>
<CaseID>102114</CaseID>
<CaseProductID>1</CaseProductID>
<ProductName>Product B</ProductName>
</Table1>
<Table1>
<CaseID>102114</CaseID>
<CaseProductID>2</CaseProductID>
<ProductName>Product A</ProductName>
</Table1>
<Table2>
<ProductIssue>Not applicable</ProductIssue>
<CaseID>102114</CaseID>
</Table2>
<Table3>
<CaseID>102114</CaseID>
<CaseCallerID>23290</CaseCallerID>
<CallerName>John Doe</CallerName>
<Address>123 Main Street</Address>
<City>Brooklyn</City>
<State>NY</State>
<ZipCode>12345</ZipCode>
<Country>USA</Country>
<Phone>1234567890</Phone>
<Relation>Self</Relation>
</Table3>
<Table4>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Gender>Male</Gender>
<ExposureTime />
<ManagementSite>Managed on site</ManagementSite>
<SymptomOnset>30 min or less</SymptomOnset>
<SymptomDuration>Unknown</SymptomDuration>
<Age>Unknown</Age>
<Severity>Minor</Severity>
<Table5>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<ExposureRoute>Dermal</ExposureRoute>
</Table5>
<Table6>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Symptom>: Irritation/Pain</Symptom>
</Table6>
<Table7>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Therapy>wash</Therapy>
</Table7>
<Table7>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Therapy>Other</Therapy>
</Table7>
</Table4>
<Table8>
<Note>Caller used product this morning</Note>
<CreatedOn>2005-06-14T07:27:00.0000000-05:00</CreatedOn>
<CaseID>102114</CaseID>
</Table8>
<Table8>
<Note>No Followup number. Close case.</Note>
<CreatedOn>2001-06-21T12:12:00.0000000-05:00</CreatedOn>
<CaseID>102114</CaseID>
</Table8>
</Table0>
I need to convert all this data to a CSV format. How do I do it using
XSLT. I can do the simple for each loop but when it comes to the
nested Table1, Table2 I get lost how do I reference those nested values
notice that All the Tables 0 to 8 can have 0 to n number of entries
with Table 0 needing at least one.
<Table0>
<CaseID>102114</CaseID>
<CaseNumber>1</CaseNumber>
<DateOpened>2005-06-14T07:26:00.0000000-05:00</DateOpened>
<OnCallPerson />
<CallType>Exposure</CallType>
<ExposureReason>General</ExposureReason>
<OtherExposureReason>Unintentional</OtherExposureReason>
<ClientName>Test Client</ClientName>
<Priority>Medium</Priority>
<Table1>
<CaseID>102114</CaseID>
<CaseProductID>1</CaseProductID>
<ProductName>Product B</ProductName>
</Table1>
<Table1>
<CaseID>102114</CaseID>
<CaseProductID>2</CaseProductID>
<ProductName>Product A</ProductName>
</Table1>
<Table2>
<ProductIssue>Not applicable</ProductIssue>
<CaseID>102114</CaseID>
</Table2>
<Table3>
<CaseID>102114</CaseID>
<CaseCallerID>23290</CaseCallerID>
<CallerName>John Doe</CallerName>
<Address>123 Main Street</Address>
<City>Brooklyn</City>
<State>NY</State>
<ZipCode>12345</ZipCode>
<Country>USA</Country>
<Phone>1234567890</Phone>
<Relation>Self</Relation>
</Table3>
<Table4>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Gender>Male</Gender>
<ExposureTime />
<ManagementSite>Managed on site</ManagementSite>
<SymptomOnset>30 min or less</SymptomOnset>
<SymptomDuration>Unknown</SymptomDuration>
<Age>Unknown</Age>
<Severity>Minor</Severity>
<Table5>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<ExposureRoute>Dermal</ExposureRoute>
</Table5>
<Table6>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Symptom>: Irritation/Pain</Symptom>
</Table6>
<Table7>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Therapy>wash</Therapy>
</Table7>
<Table7>
<CaseID>102114</CaseID>
<CasePatientID>102114</CasePatientID>
<Therapy>Other</Therapy>
</Table7>
</Table4>
<Table8>
<Note>Caller used product this morning</Note>
<CreatedOn>2005-06-14T07:27:00.0000000-05:00</CreatedOn>
<CaseID>102114</CaseID>
</Table8>
<Table8>
<Note>No Followup number. Close case.</Note>
<CreatedOn>2001-06-21T12:12:00.0000000-05:00</CreatedOn>
<CaseID>102114</CaseID>
</Table8>
</Table0>
I need to convert all this data to a CSV format. How do I do it using
XSLT. I can do the simple for each loop but when it comes to the
nested Table1, Table2 I get lost how do I reference those nested values
notice that All the Tables 0 to 8 can have 0 to n number of entries
with Table 0 needing at least one.