Help with transformation

Here should go questions about transforming XML with XSLT and FOP.
njdude
Posts: 1

Help with transformation

Sat Oct 27, 2007 1:24 am

Iam stuck and would appreciate any help in writing the xsl for transforming the input xml given below to the output xml also given below

This is my input xml document,

Code: Select all

<Customer>
   <CustomerAccount>
      <ResponseHeader>
         <CorrelationId>1234</CorrelationId>
   </ResponseHeader>
      <ResponseStatus>
         <Status>Success</Status>
      </ResponseStatus>
      <CustomerSet>
         <CustomerName>Pizza Hut</CustomerName>
         <Product>Product 1</Product>
         <PurchaseMonth>October 2007</PurchaseMonth>
         <ZipSet>
            <Zip>199360</Zip>
            <Zip>94596</Zip>
            <Zip>07974</Zip>
         </ZipSet>
   </CustomerSet>
      <CustomerSet>
         <CustomerName>Dominos</CustomerName>
         <Product>Product 2</Product>
         <PurchaseMonth>October 2007</PurchaseMonth>
         <ZipSet>
            <Zip>2583</Zip>
            <Zip>48818</Zip>
         </ZipSet>
   </CustomerSet>
   </CustomerAccount>
<Customer>


I need the xsl to transform it to the output given below,

Code: Select all

<ListOfCustomers>
   <MyCustomer>
      <Id>1234</Id>
      <AccountName>Pizza Hut</AccountName>
      <BillMonth>October 2007</BillMonth>
      <Product>Product 1</Product>
      <Zip>199360</Zip>
   </MyCustomer>
   <MyCustomer>
      <Id>1234</Id>
      <AccountName>Pizza Hut</AccountName>
      <BillMonth>October 2007</BillMonth>
      <Product>Product 1</Product>
      <Zip>94596</Zip>
   </MyCustomer>
   <MyCustomer>
      <Id>1234</Id>
      <AccountName>Pizza Hut</AccountName>
      <BillMonth>October 2007</BillMonth>
      <Product>Product 1</Product>
      <Zip>07974</Zip>
   </MyCustomer>
   <MyCustomer>
      <Id>1234</Id>
      <AccountName>Dominos</AccountName>
      <BillMonth>October 2007</BillMonth>
      <Product>Product 2</Product>
      <Zip>2583</Zip>
   </MyCustomer>
   <MyCustomer>
      <Id>1234</Id>
      <AccountName>Dominos</AccountName>
      <BillMonth>October 2007</BillMonth>
      <Product>Product 2</Product>
      <Zip>48818</Zip>
   </MyCustomer>
</ListOfCustomers>

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests