xsl-list
[Top] [All Lists]

Reading two xmls and changing the attribute names in the first xml conditionally

2005-07-06 01:34:27

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>