2011-02-08 9 views
2

XMLファイルのコンテンツをXFormsでレンダリングする際に、少し問題があります。私はそれで多くの経験を持っていないので、誰かが私に偉大なヒントを与えることができる場合。XFormsの繰り返しの問題

私のXMLは、このようなものになります。私はどのように私はそれを変更する必要があります...私は、毎日の唯一の最初のコースを取得

<xforms:repeat nodeset="day/course" id="whatever"> 
    <!-- here handling of nodes --> 
    </xforms:repeat> 

を言うなら私はすべてのために取得

<schedule> 
    <day> 
    <course> 
    </course> 
    <course> 
    </course> 
    .. 
    </day> 
    <day> 
    <course> 
    </course> 
    .. 
    </day> 
    .. 
</schedule> 

を1日のコースはノードですか?

おかげ

答えて

1

すべて<day>の、すべての<course>あそこ繰り返す必要があります持っての繰り返し。たとえば、次のようになります。数学、物理学、英語、歴史。

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" 
      xmlns:xforms="http://www.w3.org/2002/xforms" 
      xmlns:ev="http://www.w3.org/2001/xml-events" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xhtml:head> 
     <xhtml:title>Repeat</xhtml:title> 
     <xforms:model> 
      <xforms:instance> 
       <schedule> 
        <day label="Monday"> 
         <course label="Math"/> 
         <course label="Physics"/> 
        </day> 
        <day> 
         <course label="English"/> 
         <course label="History"/> 
        </day> 
       </schedule> 
      </xforms:instance> 
     </xforms:model> 
    </xhtml:head> 
    <xhtml:body> 
     <xforms:repeat nodeset="day/course"> 
      <xhtml:div> 
       <xforms:output value="@label"/> 
      </xhtml:div> 
     </xforms:repeat> 
    </xhtml:body> 
</xhtml:html> 

しかし、多くの場合、何がやりたいことのように、その後、コース上で、日間の最初の反復である:

<xforms:repeat nodeset="day"> 
    <xhtml:div> 
     Day: <xforms:output value="@label"/> 
     <xforms:repeat nodeset="course"> 
      <xhtml:div>Course: <xforms:output value="@label"/></xhtml:div> 
     </xforms:repeat> 
    </xhtml:div> 
</xforms:repeat> 
+0

どうもありがとう!魅力のように働いた:) – AndaP

+0

更新をありがとう、私はこれが助けてうれしいです。 – avernet

関連する問題