[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Reading two xmls and changing the attribute names in t

Subject: Reading two xmls and changing the attribute names in the first xml conditionally
From: "Lakshmi narayana" <lchintala@xxxxxxxxxxxx>
Date: Wed, 6 Jul 2005 13:34:27 +0500
reading two xml files
Hi,

I have one interesting problem.
1) I am having two xml files.
2) In the first xml file, for each node there is an attribute called Type
which says to which group it belongs.
First xml file looks like this.
<A1 name="A1" sequence="1" Description="optional" Type="AGroup">
         <B1 name="B1" sequence="101" order="first" Type="BGroup"/>
         <B2>
                  <C1 name="C1" sequence="201" order="Sec"
Type="CGroup"></C1>
                  <C2 name="C2" sequence="202" order="Sec" Type="CGroup">
							<C3/>
                           <D1 name="D1" Min="1" Max="1" Reference="Trr"
Predicate="" Type="DGroup">
			<C2 name="C2" sequence="202" order="Sec" Type="CGroup" />
		  </D1>

                  </C2>
         </B2>
</A1>

3) I have second xml file which contains groups and in that groups source
and destination elements are there.
Second xml file looks like this.
<AGroup>
         <map id="1">
	<source name="name"/>
            <destination name="A-Element-Name"/>
          </map>
          <map id="2">
	source name="sequence"/>
            <destination name="A-sequence"/>
          </map>
         <map id="3">
	<source name="Description"/>
             <destination name="A-Description"/>
          </map>

</AGroup>
<BGroup>
	  <map id="1">
		<source name="name"/>
           		 <destination name="B-Element-Name"/>
          	</map>
	  <map id="2">
		<source name="sequence"/>
           		 <destination name="B-sequence"/>
              </map>
 	<map id="3">
		<source name="order"/>
            		<destination name="B-order"/>
             </map>
</BGroup>
<CGroup>
	  <map id="1">
		<source name="name"/>
           		 <destination name="C-Element-Name"/>
          	</map>
	  <map id="2">
		<source name="sequence"/>
            		<destination name="C-sequence"/>
               </map>
	  <map id="3">
		<source name="order"/>
	            <destination name="C-order"/>
               </map>
</CGroup>
<DGroup>
	  <map id="1">
		<source name="name"/>
 	           <destination name="D-Element-Name"/>
          	</map>
	  <map id="2">
		<source name="Min"/>
            		<destination name="D-Min"/>
          	</map>
	<map id="3">
		<source name="Max"/>
            		<destination name="D-Max"/>
          </map>
         <map id="4">
		<source name="Reference"/>
            		<destination name="D-Reference"/>
          </map>
 	  <map id="5">
		<source name="Predicate"/>
            		<destination name="D-Predicate"/>
          </map>
</DGroup>
4) In my xsl file, I have to read the two xml files and change the attribute
names of each node like specified in
    the second xml file.
	for eg : for A1 node in first xml, the attributes should change their like
(in resultant tree)
		<A1 D-Element-Name="A1" A-sequence="1" A-Description="optional"
Type="AGroup">

5) Based on the Type attribute in the first xml, xslt should read the
specified node in the second xml, then compare the attribute name
and change the name specified in second xml file.

6) Can any one send me the xsl code for this scenario.

Thanks,
Laxmi Narayana

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.