2011-03-17 3 views
1

다음 데이터 인스턴스가 있습니다. 내가 좋아하는 것xforms에있는 여러 요소의 concat

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" 
xmlns:exforms="http://www.exforms.org/exf/1-0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
<xhtml:head> 
    <xforms:instance id="instanceData"> 
     <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
      <fruits> 
       <fruit> 
        <fruit-name>Mango</fruit-name> 
       </fruit> 
       <fruit> 
        <fruit-name>Apple</fruit-name> 
       </fruit> 
       <fruit> 
        <fruit-name>Banana</fruit-name> 
       </fruit> 
      </fruits> 
      <all-fruits></all-fruits> 
     </form> 
    </xforms:instance> 
</xhtml:head> 
</xhtml:html> 

는 태그

<all-fruits>Mango Apple Banana</all-fruits> 

가 동일하게 달성 할 수있는 방법을 제안하십시오 아래로 모든 과일에있는 모든 과일 이름을 가지고있다. 그것은 나를 위해 xxforms 시도했을 때 작동하지 않았다 : iterate 및 concat. 다음

답변

2

트릭을 수행합니다

<xforms:bind nodeset="all-fruits" 
      calculate="string-join(../fruits/fruit/fruit-name, ' ')"/> 

을 그리고 여기 당신이 그것을 실행할 수 있도록 전체 소스입니다 :

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" 
      xmlns:exforms="http://www.exforms.org/exf/1-0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xforms="http://www.w3.org/2002/xforms"> 
    <xhtml:head> 
     <xforms:model> 
      <xforms:instance id="instanceData"> 
       <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
        <fruits> 
         <fruit> 
          <fruit-name>Mango</fruit-name> 
         </fruit> 
         <fruit> 
          <fruit-name>Apple</fruit-name> 
         </fruit> 
         <fruit> 
          <fruit-name>Banana</fruit-name> 
         </fruit> 
        </fruits> 
        <all-fruits></all-fruits> 
       </form> 
      </xforms:instance> 
      <xforms:bind nodeset="all-fruits" calculate="string-join(../fruits/fruit/fruit-name, ' ')"/> 
     </xforms:model> 
    </xhtml:head> 
    <xhtml:body/> 
</xhtml:html>