Re: [xsl] breaking xsl loop or template

Subject: Re: [xsl] breaking xsl loop or template
From: "Prasad Akella" <avlnprasad@xxxxxx>
Date: Thu, 17 Feb 2005 18:37:35 +0100
hello its me again

i am sorry to paste such a code. i have been able to solve the problem so please do not spend any more time on this problem. have a nice time

with regards,
prasad

xsl-list@xxxxxxxxxxxxxxxxxxxxxx schrieb am 17.02.05 18:08:19:
> 
> hello
> 
> i would like to break an xsl loop until some user action is done and then proceed further. for example
> 
> if the user were to write an exam with a set of questions being obtained from the xml, i should be able to display one question, wait till the user has entered the answer and only then display the next question. actually this is a problem when i am working with xforms as there is no interaction between xforms and xsl
> 
> 
> 
> my code looks like this
> 
> Online Exam
> ----------i write some stuff in xforms here------------and then call the template----
> <xsl:apply-templates mode="content" select="Exam/Question"/>
> ------------------------ this is template doing the actual question paper---------
> <xsl:template name="show" match="Question" mode="content">
> <xforms:label>Question:
> <xsl:value-of select="@No"/>
> </xforms:label>					
> <xforms:label id="marks">Marks:
> <xsl:value-of select="Marks"/>
> </xforms:label>						
> <xforms:label id="question">
> <xsl:value-of select="Problem"/>
> </xforms:label>					
> <xsl:if test="@Qtype='Blank'">
> <xforms:input ref="/Exam/Question/Answer" id="{identity}">
> <xforms:label>Answer:</xforms:label>
> </xforms:input>									
> </xsl:if>
> <xsl:if test="@Qtype='Explain'">								
> <xforms:textarea ref="/Exam/Question/Answer" id="{identity}">
> <xforms:label>Explain:</xforms:label>
> </xforms:textarea>								
> </xsl:if>
> </xsl:template>
> 
> ----------------------- depending upon the type of question i would like to display controls so that the user can select answers
> i also have single select (Radio) and multiselect (check box) -----------------------
> 
> the "ref" attribute with every xforms control indicates the xml element into which the data from the user has to be written. 
> 
> my problem is that all the questions are rendered continuously. once its over, the user interaction starts. so if i have 10 questions, then the 10 questions are rendered and then the user interaction of answering each question starts but i am not able to specify that this input from the user has to go into this answer tag where the question number is same. thus i end up with only my first answer tag being filled with the last answer since the position of the tree is back to start of Question. 
> 
> i am not able to pass variables into xforms nor take any input from xforms to xsl. can someone please help me with this problem. i am stuck with this for quite long. my xml looks like this - the "Answer" tag is used to record the user input. 
> 
> Exam>
> 	<Question No="1" Qtype="Blank">
> 		<Problem>What does XML stand for</Problem>
> 		<Key>eXtensible Markup Language</Key>
> 		<Marks>3</Marks>
> 		<Answer/>
> 	</Question>
> <Question No="2" Qtype="Explain">
> 		<Problem>Explain the advantages of XML</Problem>
> 		<Key>1. XML is useful for writing text with tags
> 2. its free form
> 3. has many more advantages</Key>
> 		<Marks>5</Marks>
> 		<Answer/>
> 	</Question>
> 				
> 					
> with regards,
> Prasad Akella
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> 


______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

Current Thread