Subject: RE: Re: [xsl] for-each loops: arithmetic functions From: "Mazza, Glen" <glen.mazza@xxxxxxx> Date: Wed, 3 Jan 2001 11:43:53 -0500 |
> > Date: Tue, 2 Jan 2001 16:21:09 -0700 (MST) > From: Mike Brown <mike@xxxxxxxx> > Subject: Re: [xsl] for-each loops: arithmetic functions > > > average days overdue: <xsl:value-of > select="totalDaysOverdue" div > > select="finePerDay"/> > > <xsl:value-of select="totalDaysOverdue div finePerDay"/> > > > total $ collected: <xsl:value-of select="finePerDay" * > > select="totalDaysOverdue"/><BR/> > > <xsl:value-of select="finePerDay * totalDaysOverdue"/> > > Kicking yourself yet? :) > Not yet, Mike (also David)--I wish I were! I copied and pasted your text (actually, we made a trivial error with "average days overdue", but anyway) into the xsl file. The IE 5.5 browser is complaining about both. XML stub: > <libraries> > <library> > <name>Branch Library #2</name> > <booksOverdue>73</booksOverdue> > <totalDaysOverdue>310</totalDaysOverdue> > <finePerDay>0.20</finePerDay> > </library> > </libraries> XSL file: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML><BODY> <xsl:for-each select="libraries/library"> Name: <xsl:value-of select="name"/><BR/> # books overdue: <xsl:value-of select="booksOverdue"/><BR/> total days overdue: <xsl:value-of select="totalDaysOverdue"/><BR/> total $ collected: <xsl:value-of select="finePerDay * totalDaysOverdue"/> <BR/> avg. days overdue: <xsl:value-of select="totalDaysOverdue div booksOverdue"/> <BR/> </xsl:for-each> </BODY></HTML> </xsl:template> </xsl:stylesheet> This works fine if I don't insert the last two statements that have arithmetic expressions. error message when I insert "total $ collected" line alone: Expected token 'eof' found '*'. finePerDay -->*<-- totalDaysOverdue error message when I insert "avg. days overdue" line alone: Expected token 'eof' found 'NAME'. totalDaysOverdue -->div<-- booksOverdue I must be making a stupid syntactical error somewhere, but I've tried every permutation that comes to mind. Thanks, Glen glen.mazza@xxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] for-each loops: arithmet, David Carlisle | Thread | Re: [xsl] for-each loops: arithmet, David Carlisle |
Re: [xsl] Fallback from document() , Miloslav Nic | Date | [xsl] Newbie - Trying to read in a , Melissa Mussitsch |
Month |