Subject: Re: [xsl] loop problem (NEWBIE) From: "J.Pietschmann" <j3322ptm@xxxxxxxx> Date: Mon, 09 Sep 2002 19:58:05 +0200 |
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> ...
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] loop problem (NEWBIE), thomas | Thread | Re: [xsl] loop problem (NEWBIE), Mike Brown |
Re: [xsl] xpath problem again, Mike Brown | Date | Re: [xsl] XSL transform escape ques, Mike Brown |
Month |