|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Re: for-each loops: arithmetic functions
> > Date: Tue, 2 Jan 2001 16:21:09 -0700 (MST) > From: Mike Brown <mike@xxxxxxxx> > Subject: Re: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








