Convert XML data into XSLT format using C# in ASP.Net

Last Reply 6 days ago By pandeyism

Posted 6 days ago

I want to convert my XML data into XSLT format

XML code:

<?xml version="1.0" encoding="UTF-8"?>
<CreditMemo>
<ID>1</ID>
<DocumentNo>SCM000003</DocumentNo>
<DocumentType>CRM</DocumentType>
<CustomerNo>DES001</CustomerNo>
<DocumentDate>2019-01-18T00:00:00+05:30</DocumentDate>
<PostingDate>2019-01-18T00:00:00+05:30</PostingDate>
<DueDate>2019-01-18T00:00:00+05:30</DueDate>
<DocumentTotal>-280.35</DocumentTotal>
<AmountDue>280.35</AmountDue>
<Pay>0.00</Pay>
<Status>Approved</Status>
<TaxBase>0.00</TaxBase>
<Rate>0.00</Rate>
<TaxAmount>0.00</TaxAmount>
<CurrencyCode>USD</CurrencyCode>
<CreatedDate>2019-01-31T00:00:00+05:30</CreatedDate>
<UpdatedDate>2019-01-31T00:00:00+05:30</UpdatedDate>
<PaymentControl>AR</PaymentControl>
<InvoiceEntryType>CSMEM</InvoiceEntryType>
<TenantId>1</TenantId>
<SalesSite>NA012</SalesSite>
<CreditDetail>
<Id>1</Id>
<CustomerNo>DES001</CustomerNo>
<Item>BMS012</Item>
<Description>PCI E 128 Mb graphics adapter</Description>
<Qty>5.00</Qty>
<HeaderId>1</HeaderId>
<CreatedDate>2019-01-31T00:00:00+05:30</CreatedDate>
<UpdatedDate>2019-01-31T00:00:00+05:30</UpdatedDate>
</CreditDetail>
<CreditDetail>
<Id>2</Id>
<CustomerNo>KIN005</CustomerNo>
<Item>BMS003</Item>
<Description>7 Sprockets</Description>
<Qty>2.00</Qty>
<HeaderId>1</HeaderId>
<CreatedDate>2019-01-31T00:00:00+05:30</CreatedDate>
<UpdatedDate>2019-01-31T00:00:00+05:30</UpdatedDate>
</CreditDetail>
</CreditMemo>

And i want it in xslt format like this :

<PARAM>

<GRP ID="SIH0_1">

<FLD NAME="SALFCY" TYPE="Char">NA012</FLD>

<FLD NAME="SIVTYP" TYPE="Char">CRM</FLD>

<FLD NAME="BPCINV" TYPE="Char">NA002</FLD>

</GRP>

<GRP ID="SIH1_1">

<FLD NAME="BPCORD" TYPE="Char">NA002</FLD>

<FLD NAME="BPRPAY" TYPE="Char">NA002</FLD>

<FLD NAME="BPCGRU" TYPE="Char">NA002</FLD>

</GRP>

<GRP ID="SIH1_4">

<FLD MENULAB="Invoice" MENULOCAL="413" NAME="SIHORI" TYPE="Integer">4</FLD>

<FLD NAME="SIHORINUM" TYPE="Char">DIR000075</FLD>

</GRP>

<TAB DIM="300" ID="SIH4_1" SIZE="1">

<LIN NUM="1">

<FLD NAME="ITMREF" TYPE="Char">BMS001</FLD>

<FLD NAME="QTY" TYPE="Decimal">1</FLD>

<FLD NAME="GROPRI" TYPE="Decimal">3.0758</FLD>

</LIN>

</TAB>

</PARAM>