[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] variable going out of scope in a for-each loop?
Subject: Re: [xsl] variable going out of scope in a for-each loop? From: Nate Austin <naustin@xxxxxxxxxx> Date: Mon, 10 Dec 2001 10:17:19 -0600 |
Eric - If it's always the last two nodes that you want to multiply, then it's pretty straight forward: <xsl:value-of select="cell[last()-1] * cell[last()]"/> (where row is the current node). If you just want the product of all nodes that are numbers, you have to use a recursive process. You can start by selecting all number nodes by using a select expression similar to the xsl:if you used: <xsl:variable name="numberNodes" select="cell[number(.)=number(.)]"/> (replace xsl:variable with xsl:with-param to pass it to your recursive template). Alternately, if it's possible to use extension functions and you're using Saxon, I'm sure Mike has one that'll make this job a piece of cake. I'll leave it to him (or whoever else steps up) to give that to you. Hope that helps. -Nate >Date: Mon, 10 Dec 2001 00:20:22 +0100 >From: Eric Smith <Eric.Smith@xxxxxxxxxxxx> >Subject: Re: [xsl] variable going out of scope in a for-each loop? > >- - perhaps i am going about this the wrong way - i need to calcualte the product of the >last two cells in a row viz. > > <row header="phase"> > <cell> > John Doe > </cell> > <cell> > Engineer > </cell> > <cell> > 246 > </cell> > <cell> > 135 > </cell> > </row> > >This should be so easy to do (maybe it is?). > >- -- >Eric Smith - currently using xalan and xsltproc - what a difference speed makes - and fop on linux XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] variable going out of sco, David Carlisle | Thread | Re: [xsl] variable going out of sco, Eric Smith |
Re: [xsl] C++ xslt fo engine, ronald heller | Date | [xsl] xsl processor detector, TP |
Month |