xsl-list
[Top] [All Lists]

breaking xsl loop or template

2005-02-17 10:08:00
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>