I have an XML with the following structure:
<Root>
<Record>
<Field1>ABC</Field1>
<Field2>DEF</Field2>
<MatchingSubRecords>
<SubField1>SUB01</SubField1>
<SubField2>SUB02</SubField2>
</MatchingSubRecords>
<MatchingSubRecords>
<SubField1>SUB11</SubField1>
<SubField2>SUB11</SubField2>
</MatchingSubRecords>
<MatchingSubRecords>
<SubField1>SUB21</SubField1>
<SubField2>SUB22</SubField2>
</MatchingSubRecords>
</Record>
</Root>
Whilst I have a simple XSLT to transform every record into a text output of
Field1, Field2
ABC,DEF
I would like to either have every matching sub records in a similar CSV output either as a separate file or with a separate delimitting character as part of the main CSV output itself, something like
ABC, DEF, "SUB01,SUB11,SUB21|SUB02,SUB12,SUB22"
If there is a possibility in using XslCompiledTransform to stream write it as two files, that would be perfect. If not, I would have to parse it later, which is fine as well.
By simple transformation you can achive the desire output:
If you have multiple n number of occurances then you can use like below without specifying element name:
See this link for your reference: https://xsltfiddle.liberty-development.net/ejivdHr