xsl-list
[Top] [All Lists]

[xsl] Comparing xslt attributes and putting them in sequential order

2014-08-12 07:08:40
Hi,

I have two files and I am trying to merge them.
I want to compare the attribute value of "version" with in the same file,
if the values are different I want to copy them in sequential order but if
they are same then those attribute should have the same value.

Any kind of help is appreciated. :)
I have pasted my files below:

*File1.xml*
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <version>
     <input00 version ="1"/>
<name00 name ="abc"/>
  </version>
   <version>
     <input00 version ="2"/>
<name00 name ="def"/>
  </version>
</config>


*File2.xml*
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <version>
     <input00 version ="1"/>
     <name00 name ="xyz"/>
  </version>
    <version>
     <input00 version ="2"/>
     <name00 name ="pqr"/>
  </version>
  </version>
    <version>
     <input00 version ="2"/>
     <name00 name ="pqr1"/>
  </version>
    <version>
     <input00 version ="3"/>
     <name00 name ="uvw"/>
  </version>
   <version>
     <input00 version ="3"/>
     <name00 name ="uvw1"/>
  </version>
    <version>
     <input00 version ="4"/>
     <name00 name ="lmn"/>
  </version>
</config>


*Output.xml*
<config>
  <version>
     <input00 version ="1"/>
     <name00 name ="abc"/>
  </version>
    <version>
     <input00 version ="2"/>
     <name00 name ="def"/>
  </version>
  </version>
    <version>
     <input00 version ="3"/>
     <name00 name ="xyz"/>
  </version>
    <version>
     <input00 version ="4"/>
     <name00 name ="pqr"/>
  </version>
   <version>
     <input00 version ="4"/>
     <name00 name ="pqr1"/>
  </version>
    <version>
     <input00 version ="5"/>
     <name00 name ="uvw"/>
  </version>
  </version>
    <version>
     <input00 version ="5"/>
     <name00 name ="uvw1"/>
  </version>
    <version>
     <input00 version ="6"/>
     <name00 name ="lmn"/>
  </version>
</config>

Thanks,
BR,
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>