XML Transformation using XSLT








We have a complex XDP for Appraiser Application Form with XML Data Model (default one, nothing fancy). There is another XDP of the same Application Form, same layout, but with different model and XML Structure. The XML Structure of the 2nd form is based on format which I am not familiar with, but I can understand what is in there.

The 1st XML is plain vanilla XML, straight forward.

The 2nd XML has multiple nested sections, and the field names are specified in the attribute of the tag element. The images are specified in the attachment section, and the are references from the relevant tag element.

Following is a sample of the 1st XML:





  <NEW_Stage>Stage Value</NEW_Stage>


  <NEW_POOL_X>Nice Pool</NEW_POOL_X>





Following is a sample of the 2nd XML:

<app_rep2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.1">







        <collection>Report Pro</collection>

        <platform>Desktop Platform</platform>




      <form name="photo1" primary="false">

        <section type="other" number="0" name="section_name1">

          <tag name="TITLE_PHOTO">SamplePhotoLabel1</tag>

          <tag name="LINE_PHOTO">SamplePhotoDescription1</tag>


        <tag name="PHOTO1">../../../attachments/attachment[@key='267463fa-0073-4c10-83d6-fd8141641b72']</tag>


      <form name="Some-primary-form" primary="true">

        <section type="other" number="0" name="OPTIONS">

          <tag name="OPT_TYPE_OF_APPRAISAL">Appraisal Type Value</tag>


        <section type="subject" number="0" name="SUBJECT">

          <tag name="CITY">Toronto</tag>

          <tag name="STATE">Stage Value</tag>

          <tag name="GS_AGE">23</tag>

          <tag name="POOL_X">Nice Pool</tag>





      <attachment type="photo" label="" key="267463fa-0073-4c10-83d6-fd8141641b72">


          <binary format="jpeg">/9j/4AAQSkZJRgABAAEASABIAAD//gAfTEVBRCBUZWNobm9sb2dpZXMgSW5jLiBWMS4wMQD/2wCE








As you can see, I want to transform the 2nd XML to look like the 1st XML.

I think I need to first write the XSLT. Then, I need to import the 2nd XML into the 1st XDP, and apply the XSLT while importing.

Am I thinking in the right direction?

Can you please help achieve my goal? I am not exactly sure how to do that.


1. How to develop the XSLT?

2. How to apply the XSLT while merging the 2nd XML with the 1st XDP? How I can do than using Acrobat? How I can do that using Adobe LiveCycle Process Management?

Any help would be appreciated.



View Entire Topic








I think i can manage to write XSLT to perform the transformation. However, I am facing the following difficulties:

1. The image fields are located in another element. I mean, you have to do another lookup to find the image Base64 data. For example, the image field in the XML above app_rep2/appraisal/form[@name="photo1"]/tag[@name="PHOTO1"] is pointing to "../../../attachments/attachment[@key='267463fa-0073-4c10-83d6-fd8141641b72']" which has the image data and possibly some other details. I was unable to use XSL to perform this operation. I found some libraries that can do that, see this for example:


When I tried to use the library, it didn't work, I am not sure why. Also, I don't know if this is supported with Adobe XFA and Acrobat.

2. The form has more than 1000 fields. I am wondering if there is a tool or a method that will help to make this job easier. For example, I am thinking to have someone work on the mapping and prepare an Excel Sheet with field name mapping from XML 1 to XML 2. This is easy but time consuming. Then, we will write the XSL, and use some method to find/replace all fields based in the field mapping done in Excel Sheet. I can write a JavaScript program for this, but I am trying to avoid this route.