2009-08-08 5 views
0

J'ai quelques questions, parce que je ne suis pas bon dans XSLT ...Il est possible de connecter deux ensemble de xml

Par exemple, j'ai 3 types de xml de trois sociétés

XML 1 (Société 1) file1.xml

<HotelList name="Company1"> 
    <Hotel><HotelCode>C1004</HotelCode> 

       <HotelName>Hotel 4</HotelName> 

       <Price>100</Price> 

    </Hotel> 
    <Hotel><HotelCode>C1001</HotelCode> 

       <HotelName>Hotel 1</HotelName> 

       <Price>20</Price> 

    </Hotel> 
    <Hotel><HotelCode>C1003</HotelCode> 

       <HotelName>Hotel 3</HotelName> 

       <Price>15</Price> 

    </Hotel> 
    <Hotel><HotelCode>C1002</HotelCode></HotelList> 

       <HotelName>Hotel 2</HotelName> 

       <Price>10</Price> 

    </Hotel> 

XML 2 (Société 2) file2.xml

<HotelList name="Company2"> 
    <Hotel><HotelCode>C2002</HotelCode> 

       <HotelName>Hotel Two</HotelName> 

       <PriceList><Price>15</Price></PriceList> 

    </Hotel> 
    <Hotel><HotelCode>C2005</HotelCode> 

       <HotelName>Hotel Five</HotelName> 

       <PriceList><Price>100</Price></PriceList> 

    </Hotel> 
    <Hotel><HotelCode>C2003</HotelCode> 

       <HotelName>Hotel Three</HotelName> 

       <PriceList><Price>7</Price></PriceList> 

    </Hotel> 
    <Hotel><HotelCode>C2004</HotelCode> 

       <HotelName>Hotel Four</HotelName> 

       <PriceList><Price>99</Price></PriceList> 

    </Hotel> 


    <Hotel><HotelCode>C2001</HotelCode> 
</HotelList> 

       <HotelName>Hotel One</HotelName> 

       <PriceList><Price>10</Price></PriceList> 



</Hotel> 

XML 3 (Société 3) file3.xml

<HotelList name="Company2"> 
    <Hotel><HotelCode>13 </HotelCode> 

       <HotelName>Hotel One</HotelName> 

       <Rates><PriceList><Price>11</Price></PriceList></Rates> 

    </Hotel> 
    <Hotel><HotelCode>23</HotelCode> 

       <HotelName>Hotel Two</HotelName> 

       <Rates><PriceList><Price>8</Price></PriceList></Rates> 

    </Hotel> 
    <Hotel><HotelCode>53</HotelCode> 

       <HotelName>Hotel Five</HotelName> 

       <Rates><PriceList><Price>100</Price></PriceList></Rates> 

    </Hotel> 

    <Hotel><HotelCode>63</HotelCode> 

       <HotelName>Hotel Six</HotelName> 

       <Rates><PriceList><Price>120</Price></PriceList></Rates> 

    </Hotel> 
    <Hotel><HotelCode>33</HotelCode> 

       <HotelName>Hotel Three</HotelName> 

       <Rates><PriceList><Price>7</Price></PriceList></Rates> 

    </Hotel> 
    <Hotel><HotelCode>43</HotelCode> 

       <HotelName>Hotel Four</HotelName> 

       <Rates><PriceList><Price>85</Price></PriceList></Rates> 

    </Hotel> 


</HotelList> 

1) Voici le code XML, les ids de l'hôtel ne sont pas pour ainsi

2) id Hôtel et les noms de l'hôtel est pas un

constante 3) Si id hôtel est pas constant, il est un besoin de créer une table sql pour garder l'identifiant constant? Quelque chose comme ça

HotelName    HotelCode   NewHotelName   NewHotelCode 

Hotel 1     C1001    Hotel-1       1 

Hotel 2     C1002    Hotel-2       2 

Hotel 3     C1003    Hotel-3       3 

Hotel 4     C1004    Hotel-4       4 

Hotel One    C2001    Hotel-1       1 

Hotel Two    C2002    Hotel-2       2 

Hotel Three    C2003    Hotel-3       3 

Hotel Four    C2004    Hotel-4       4 

Hotel Five     C2005    Hotel-5       5 

Hotel One     13     Hotel-1       1 

Hotel Two     23     Hotel-2       2 

Hotel Three    33     Hotel-3       3 

Hotel Four     43     Hotel-4       4 

Hotel Five     53     Hotel-5       5 

Hotel Six     63     Hotel-6       6 

3) Mon but est que, pour afficher moins les hôtels de prix (avec double sortie) de ces

de trois xml

4) Je dois le résultat est

Hotel Name: Hotel-1 

Hotel Code: C2001 

Hotel New Code: 1 

Price :10 



Hotel Name: Hotel-2 

Hotel Code: 23 

Hotel New Code: 2 

Price :8 



Hotel Name: Hotel-3 

Hotel Code: C1003 

Hotel New Code: 3 

Price :7 



Hotel Name: Hotel-4 

Hotel Code: 43 

Hotel New Code: 4 

Price :85 



Hotel Name: Hotel-5 

Hotel Code: C2005 

Hotel New Code: 5 

Price :100 



Hotel Name: Hotel-6 

Hotel Code: 63 

Hotel New Code: 6 

Price :120 
+0

@Alex: Bonne peine, votre poste se compose principalement de lignes vides. Est-ce vraiment nécessaire? Les lignes vides n'améliorent pas la lisibilité, bien au contraire. S'il vous plaît, sortez les. – Tomalak

Répondre

Questions connexes