2012-07-11 7 views
-1

나는 두 노드 MANHATTAN을 병합해야 ""동일한 아버지"를 갖고 정확한 "방법"순서 (XSLT 사용)를 갖는 두 노드를 병합하는 방법은 무엇입니까? 는 "<strong>이 병합 된 속성을</strong>을 만들</p> <p>"<strong></strong> A + <strong>MODIFY</strong> 만들기 "아직 : 우리의 시스템 규칙은 다음과 같다</p> <p>때문에 :

입력 파일 :

<?xml version="1.0" encoding="UTF-8"?> 
<world> 
<COUNTRY id="USA" > 
    <STATE id="NEW JERSEY"> 
    <CITY id="NEW YORK" method="modify"> 


     <DISTRICT id="MANHATTAN" method="create"> 
      <attributes> 
       <population>99 </population> 
       <income> 10000</income> 
      </attributes> 
     </DISTRICT> 

     <DISTRICT id="MANHATTAN" method="modify"> 
      <attributes> 
       <temperature>78</temperature> 
       <income>15000</income> 
       <information>suburb of newyork</information> 
      </attributes> 
     </DISTRICT> 

    </CITY> 

    </STATE> 

예상 출력 :

<?xml version="1.0" encoding="UTF-8"?> 
<world> 
<COUNTRY id="USA" > 
    <STATE id="NEW JERSEY"> 
    <CITY id="NEW YORK" method="modify"> 

     <DISTRICT id="MANHATTAN" method="create"> 
      <attributes> 
       <population>99 </population> 
       <temperature>78</temperature> 
       <income>15000</income> 
       <information>suburb of newyork</information> 
      </attributes> 
     </DISTRICT> 

    </CITY> 
</STATE> 
</COUNTRY> 
</world> 

이 도와주세요, 난 그냥 XSLT를 시작 Perl로 그 일을 나 파이썬은 것입니다 시간이 소요했다.

+0

항상 두 개의 노드가 있습니까? – sreehari

+0

예, 완전히 옳은 것 같습니다. 규칙은 항상 1 CREATE + 1 MODIFY가 1 CREATE로 변환된다는 것입니다. – laurentngu

답변