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

RE: Very Simple Mathematical Calculation in XSL

Subject: RE: Very Simple Mathematical Calculation in XSL
From: "Uslu, Cihan Y (MED)" <Cihan.Uslu@xxxxxxxxxx>
Date: Thu, 30 Aug 2001 14:14:43 -0500
mathematical calculation test
Chris,
Thank you for your reply, it works when I have only one objective for
each module, but the problem is there are more than one objectives for
each module and I am trying to get the number of correct 
answers to pass the test for each module. I tried to play with your code
adding for-each objective but then i receive NaN error. How can I get
around this problem?

Thanks...
ps: 

-----Original Message-----
From: Chris Bayes [mailto:chris@xxxxxxxxxxx]
Sent: Thursday, August 30, 2001 1:37 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Very Simple Mathematical Calculation in XSL


Cihan,
> How do you do the calculation to get the number of correct 
> answers to pass the test for each module?

<xsl:template match="module">
	<xsl:value-of select="ceiling((@passing-score div @max-score) *
objective/@num-questions)" />
</xsl:template>

Ciao Chris

> > I am trying to do simple math calculations with XSL and I'm
> > attaching my input XML file to explain better what I'm trying 
> > to do. I am not sure how to do this in XSL.
> > 
> > This is what I want;
> > ----------------------------
> > Number of correct questions to pass the test for the module;
> >    Module Type T:
> >    	Number of questions:5
> >  	Maximum Score=100
> > 	Passing Score=80
> > 	Number of correct answers to pass the test= 4
> >   Module Type P
> >  	Number of Questions: 6
> > 	Maximum Score=100
> > 	Passing Score=80
> > 	Number of correct answers to pass the test= 4.8 ( I 
> > want to round-up this value to the closest integer value)
> > ---------------------------
> > Thank you..
> > 
> > Cihan
> > 
> > 
> > 	
> > 
> > 
> > 
> > <?xml version="1.0"?>
> > <!DOCTYPE course SYSTEM "tedsassess.dtd">
> > <course courseNum="EDITEST"> 
> >   <module test-type="T" max-score="100" passing-score="80"> 
> > 	 <title> 
> > 		<para>Test-out</para> 
> > 	 </title> 
> > 	 <intro> 
> > 		<para>This is the test-out module.</para> 
> > 	 </intro> 
> > 	 <objective title="ignore me" num-questions="5"
> > num-test-out-questions="5"> 
> > 	</objective> 
> >   </module> 
> > <module test-type="P" max-score="100" passing-score="80"> 
> > 	 <title> 
> > 		<para>Test Module 1</para> 
> > 	 </title> 
> > 	 <intro> 
> > 		<para>This is the intro to Module 1.</para> 
> > 	 </intro> 
> > 	<objective title="Objective 1.1 Title" 
> > num-questions="2" num-test-out-questions="1">
> > 	    <para>This is objective 1.1... it has a
> > <emphasis>bold</emphasisword.</para>              
> > 	</objective> 
> >              <objective title="Objective 1.2 title" 
> > num-questions="4" num-test-out-questions="1"> 
> > 	    <para>This is objective 1.2.</para>
> > 	 </objective> 
> >   </module> 
> > </course>
> > 
> >  XSL-List info and archive:  
> http://www.mulberrytech.com/xsl/xsl-list
> > 
> > 
> 
> 
>  XSL-List 
> info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


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

 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.