xsl-list
[Top] [All Lists]

[xsl] [xsl]: Need help with merging two common tags of multiple xmls

2014-08-11 03:48:56
Hi,

I am still stuck with this problem while trying to merge two common tags in
multiple xmls.
Every xml file has 4 sections:
1) systemInfo
2) systemInitialization
3) Procedure
4) systemWrapup

I have written rules for merging systemInfo systemInitialization and
systemWrapup sequentially. As they appear just once in my xmls there is no
problem. I am stuck with  Procedure tag as they may appear more than once
and I have to merge it sequentially by taking out from both the files and
modifying its attributes.

How can I achieve the output?

*File1.xml*

<?xml version="1.0" encoding="ASCII"?>
  <System saSysName="AppSysCyborg">

    <systemInfo>
      <systemPeriod sysExpectedTime="600000000"/>
      <configurationBase sysBase="0" />
    </systemInfo>

    <systemInitialization>
      <addToSys>
        ..........................
        ..........................
      </addToSys>
    </systemInitialization>

    <Procedure procName="Proc1" procLevel="1">
      <outageInfo>
        <procedurePeriod sysPeriod="100000000"/>
      </outageInfo>
      <sysAction>
        <immCCB ccbFlags="0">
          <create objectClassName="sysApplication">
            <attr name="sysAppl" type="hvm">
              <val>1</val>
            </attr>
          </create>
        </immCCB>
      </sysAction>
    </systemInstall>
    </Procedure>

    <Procedure sysSmfProcedure="Proc2" sysExecLevel="2">
      <outageInfo>
        <procedurePeriod sysPeriod="100000000"/>
      </outageInfo>
      <sysAction>
        <sysCB ccbFlags="0">
          <create objectClassName="sysApplication">
            <attr name="sysAppl" type="hvm">
              <val>1</val>
            </attr>
          </create>
        </sysCB>
      </sysAction>
     </Procedure>

    <systemWrapup>
        ..........................
        ..........................
    </systemWrapup>
  </System>


*File-2.xml*

<?xml version="1.0" encoding="ASCII"?>
  <System saSysName="Term-1">

    <systemInfo>
      <systemPeriod sysExpectedTime="600000000"/>
      <configurationBase sysBase="0" />
    </systemInfo>

    <systemInitialization>
      <addToSys>
         ..........................
      </addToSys>
    </systemInitialization>

    <Procedure procName="Proc1" procLevel="1">
      <outageInfo>
        <procedurePeriod sysPeriod="100000000"/>
      </outageInfo>
      <sysAction>
        <immCCB ccbFlags="0">
          <create objectClassName="sysApp"/>
        </immCCB>
      </sysAction>
      <systemInstall/>
    </Procedure>

    <Procedure procName="Proc2" procLevel="2">
      <outageInfo>
        <procedurePeriod sysPeriod="100000000"/>
      </outageInfo>
   </Procedure>

    <Procedure procName="Proc3" procLevel="3">
      <outageInfo>
        <procedurePeriod sysPeriod="100000000"/>
      </outageInfo>
    </Procedure>

    <systemWrapup>
         ..........................
        ..........................
    </systemWrapup>
  </System>


*Output.xml*

<?xml version="1.0" encoding="ASCII"?>
  <System saSysName="AppSysCyborg">

    <systemInfo>
      <systemPeriod sysExpectedTime="600000000"/>
      <configurationBase sysBase="0" />
    </systemInfo>

    <systemInitialization>
      <addToSys>
        ......
        ..........
      </addToSys>

      <addToSys>
        ..........................
        ..........................
        ..........................
      </addToSys>
    <sysInit>
        ..........................
        ..........................
    </sysInit>

    <sysInit>
        ..........................
        ..........................
    </sysInit>
    </systemInitialization>

*<Procedure procName="Proc1" procLevel="1">*
*      <outageInfo>*
*        <procedurePeriod sysPeriod="100000000"/>*
*      </outageInfo>*
*      <sysAction>*
*        <immCCB ccbFlags="0">*
*          <create objectClassName="sysApplication">*
*            <attr name="sysAppl" type="hvm">*
*              <val>1</val>*
*            </attr>*
*          </create>*
*        </immCCB>*
*      </sysAction>*
*    </Procedure>*

*    <Procedure procName="Proc2" sysExecLevel="2">*
*      <outageInfo>*
*        <procedurePeriod sysPeriod="100000000"/>*
*      </outageInfo>*
*      <sysAction>*
*        <sysCB ccbFlags="0">*
*          <create objectClassName="sysApplication">*
*            <attr name="sysAppl" type="hvm">*
*              <val>1</val>*
*            </attr>*
*          </create>*
*        </sysCB>*
*      </sysAction>*
*    </Procedure>  *

*<Procedure procName="Proc1" procLevel="3">*
*      <outageInfo>*
*        <procedurePeriod sysPeriod="100000000"/>*
*      </outageInfo>*
*      <sysAction>*
*        <immCCB ccbFlags="0">*
*          <create objectClassName="sysApp"/>*
*        </immCCB>*
*      </sysAction>*
*      <systemInstall/>*
*    </Procedure>*

*    <Procedure procName="Proc2" procLevel="4">*
*      <outageInfo>*
*        <procedurePeriod sysPeriod="100000000"/>*
*      </outageInfo>*
*      <sysAction>*
*        <sysCB ccbFlags="0">*
*          <create objectClassName="sysApplication">*
*            <attr name="sysAppl" type="hvm">*
*              <val>1</val>*
*            </attr>*
*          </create>*
*        </sysCB>*
*      </sysAction>*
*    </Procedure>*

*    <Procedure procName="Proc3" procLevel="3">*
*      <outageInfo>*
*        <procedurePeriod sysPeriod="100000000"/>*
*      </outageInfo>*
*    </Procedure>  *


*    <Procedure procName="Proc4" procLevel="5">*
*      <outageInfo>*
*        <procedurePeriod sysPeriod="100000000"/>*
*      </outageInfo>*
*    </Procedure>   *

  <systemWrapup>
         ..........................
        ..........................
    </systemWrapup>
  </System>

Thanks,
Varun
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] [xsl]: Need help with merging two common tags of multiple xmls, varun bhatnagar varun292006(_at_)gmail(_dot_)com <=