Subject: Re: [xsl] endless rekursion From: Mukul Gandhi <mukulgw3@xxxxxxxxx> Date: Fri, 7 Nov 2003 04:18:09 -0800 (PST) |
I guess, the following XSL will be appropriate -- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/CheckBoxQuestion"> <xsl:variable name="right" select="count(option/solution[@valid_input = '1'])" /> <xsl:variable name="wrong" select="count(option/solution[@valid_input = '0'])"/> Total points: <xsl:value-of select="$right - $wrong" /> </xsl:template> </xsl:stylesheet> Regards, Mukul --- Markus Hanel <markus.hanel@xxxxxx> wrote: > hallo, > > sorry about my terrible english. > > my problem is to check out a check box question, to > see if the answer is > right or false. > the given answer of the student to the question is > given in the solution tag > (right =1 wrong =0), the valid_input presents the > right answer the teacher > has given. to see how many right answers are given, > my idea is counting the > correct cells and counting the wrong cells. the > variable correct should give > out the difference of the right and wrong answers. > it should be a number > written into a cell of a table. > > is this possible? > > xml part > <CheckBoxQuestion> > <notice>in Europa kennen wir uns aus!</notice> > <question>Welche der nachfolgenden Länder gehören > zur EU?</question> > <option number="1"> > <text>Deutschland</text> > <solution type="bool" points="4" > valid_input="1"></solution> > </option> > <option number="2"> > <text>Schweiz</text> > <solution type="bool" points="5" > valid_input="0"></solution> > </option> > <option number="3"> > <text>Österreich</text> > <solution type="bool" points="6" > valid_input="1"></solution> > </option> > <option number="4"> > <text>Türkei</text> > <solution type="bool" points="7" > valid_input="0"></solution> > </option> > </CheckBoxQuestion> > > xsl part > <xsl:template match="CheckBoxQuestion" mode="table"> > <xsl:apply-templates select="option" mode="check" > /> > </xsl:template> > > > <xsl:template match="option" mode="check"> > <xsl:variable name="correct_cells" select=". > |following-sibling::option/solution[valid_input = > 1]" /> > <xsl:apply-templates select="$correct_cells" > mode="check" /> > > <xsl:variable name="false_cells" select=". > |following-sibling::option/solution[valid_input = > 0]" /> > <xsl:apply-templates select="$false_cells" > mode="check" /> > > <xsl:variable name="correct" > select="count($correct_cells) - > count($false_cells)" /> > > <xsl:choose> > <xsl:when test="$correct >= 0"> > <td><xsl:value-of select="$correct" /></td> > </xsl:when> > <xsl:otherwise> > <td>0</td> > </xsl:otherwise> > </xsl:choose> > > </xsl:template> > > -- > NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, > Dateien... > Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX > FotoService > > Jetzt kostenlos anmelden unter http://www.gmx.net > > +++ GMX - die erste Adresse für Mail, Message, More! > +++ > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > ve: http://www.mulberrytech.com/xsl/xsl-list > __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] endless rekursion, Markus Hanel | Thread | [xsl] Problem with Muenchian groupi, jean pujol |
RE: [xsl] Select statement within H, SHEIKH Sajjad | Date | [xsl] Problem with Muenchian groupi, jean pujol |
Month |