Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 83963 invoked from network); 13 May 2005 02:47:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 May 2005 02:47:56 -0000 Received: (qmail 62005 invoked by uid 500); 13 May 2005 02:51:54 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 61960 invoked by uid 500); 13 May 2005 02:51:53 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 61945 invoked by uid 99); 13 May 2005 02:51:53 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from vuwunicosmtp003.vuw.ac.nz (HELO vuwunicosmtp003.vuw.ac.nz) (130.195.86.28) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 12 May 2005 19:51:53 -0700 Received: from coso.staff.vuw.ac.nz (coso.staff.vuw.ac.nz [130.195.85.188]) by vuwunicosmtp003.vuw.ac.nz (8.12.11/8.12.11) with ESMTP id j4D2lece008362 for ; Fri, 13 May 2005 14:47:40 +1200 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Initializing variables in XSLT Date: Fri, 13 May 2005 14:47:37 +1200 Message-ID: <802926B6AB8533408C33ADBCA3EE5C2A021EC172@coso.staff.vuw.ac.nz> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Initializing variables in XSLT Thread-Index: AcVXQYf2RTCRt4JNRhS0WFpGX0uTLwAI1plQ From: "Conal Tuohy" To: X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Oleg Konovalov wrote: > I am new to XSLT, trying to significantly modify somebody else's XSL. You should ask these XSLT questions on the Mulberry XSL list. If you are new to XSL you'll find it invaluable. > I need to create min and max variables > to be used in many templates and sub-templates based on=20 > certain conditions (not always). See the Functional XSL project: http://fxsl.sourceforge.net/articles/FuncProg/2.html#minimum > What I don't know is: > 1) how to make template to return a value, something like: > min =3D > 2) how to declare variable and then assign it much later in the code; You have to declare and assign in the same place. Variables in XSLT are not really "variable" :-) They are like static final variables in Java. > 3) Also, it there a way to compare a value and a previous=20 > value within a for-each loop like: > > var2 > var2(position()-1)">...do something... > > > Would that work ? If "...do something" is supposed to re-assign the value of the "min" variable, then no, you can't work this way, because you can't modify the value of a variable. You can do something like this by recursing, though, so you have multiple instances of a variable on a stack (hence you're not changing it's value, just hiding it by introducing a new variable binding in a more local scope). > 4) Can I get access to a value from another branch from=20 > within for-each ? > Like: > > ...do something... > > )=20 I'm not entirely clear on what you mean. I think so. Anyway ... try the Mulberry XSL list, it's much better for pure XSL questions. Regards Con --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org