[xquery-talk] Xquery help to add element to loop

sudheshna iyer sudheshnaiyer at yahoo.com
Fri Aug 26 06:44:22 PDT 2011


I want to prepare an element of complex type and add it to the list of elements. How can I achieve this in xquery? I am using oepe..
 
My input.xml needs to be transformed into output.xml.  Please note that values of <HeaderLevel> element  should be part of the list <Addresses_transitioned>
===========
Input.xml

<customer>
 <HeaderLevel>
  <Id>3</Id>
  <HAddressLine1>haa</HAddressLine1>
  <HAddressLine2>hbb</HAddressLine2>
 </HeaderLevel>
 <Addresses>
  <Address>
   <Id>1</Id>
   <AddressLine1>aa</AddressLine1>
   <AddressLine2>bb</AddressLine2>
  </Address>
  <Address>
   <Id>2</Id>
   <AddressLine1>aa</AddressLine1>
   <AddressLine2>bb</AddressLine2>
  </Address>
 </Addresses>
</customer>
===========
Output:

<?xml version="1.0" encoding="UTF-8"?>
<customer_transitioned>
 <Addresses_transitioned>
  <Address_transitioned>
   <Id_t>1</Id_t>
   <AddressLine1_t>aa</AddressLine1_t>
   <AddressLine2_t>bb</AddressLine2_t>
  </Address_transitioned>
  <Address_transitioned>
   <Id>2</Id>
   <AddressLine1_t>aa</AddressLine1_t>
   <AddressLine2_t>bb</AddressLine2_t>
  </Address_transitioned>
  <Address_transitioned>
   <Id>3</Id>
   <AddressLine1_t>haa</AddressLine1_t>
   <AddressLine2_t>hbb</AddressLine2_t>
  </Address_transitioned>
 </Addresses_transitioned>
</customer_transitioned>




More information about the talk mailing list