[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: loop problem (NEWBIE)

Subject: Re: loop problem (NEWBIE)
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 09 Sep 2002 19:58:05 +0200
xsl for loop
thomas wrote:
I want a simple fo:table. Left cell, the question, right cell the answer.
I managed to loop over the <frage> and put the content in a new row/cell. But how do I get the accordant <antwort> in the SAME loop in the second cell?

Your XML is not well designed for this. The standard technique is to use pairs of frage+antwort. <profil> <f-a> <frage>frage 1 frage 1?</frage> <antwort>antwort 1 antwort 1 antwort 1 antwort 1</antwort> </f-a> ... BTW XSLT does not loop. Do not confuse xsl:for-each with for example a Java for(x;y;z). It is more comparable to a SQL SELECT.

If you are stuck with your XML, and you are sure the answer to
a certain question is always the antwort element after the frage
element, you can select the questions and get the according answer
using the following-sibling axis:
 ...
 <fo:table-body>
   <xsl:for-each select="/page/info/profil/frage">
     <fo:table-row>
       <fo:table-cell>
         <fo:block>
           <xsl:value-of select="."/>
         </fo:block>
       </fo:table-cell>
       <fo:table-cell>
         <fo:block>
           <xsl:value-of select="following-sibling::aantowrt[1]"/>
         </fo:block>
       </fo:table-cell>
     </fo:table-row>
   </xsl:for-each>
 </fo:table-body>
 ...

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.