Xavier,
John
is right about not being able to change variables and I think that in order to
achieve the effect you want, you should consider using some Java code inside
your XSL. I had a similar problem when trying to track indenting levels
affected by different template matches. Of course outside of each template
match that defines the variable, it does not exist so is actually pretty
useless!
One
approach
1)
Create a Java class like so
package com.myplace.utils.XSLVariable;
public
class XSLVariable
{
public static void setVar( long NewVal
)
{
ms_lVariable =
NewVal;
}
public static long getVar() { return
ms_lVariable; }
private static long ms_lVariable =
0;
}
2)
Compile the class and JAR up.
3) Add
the JAR file to the classpath for your FOP/XSL processor.
4)
Create a namespace in the XSL file as follows:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:utils="com.myplace.utils.XSLVariable" version="1.0"> 5)
Then use a dummy variable to call get and set methods to modify your
variable.
<xsl:variable name="temp"
select="utils:XSLVariable.setVar(utils:XSLVariable.getVar() +
5)"/>
or value-of to output
<xsl:value-of select="utils:XSLVariable.getVar()"/> Hope
this is useful. There is more information on how to do this in the Apache Xalan
help, but I can't remember exactly where just now.
Phil
|
- Re: Quark workflow Oleg Tkachenko
- RE: Quark workflow Stephan Wiesner
- RE: Quark workflow Joel Gwynn
- Re: Quark workflow Oleg Tkachenko
- RE: Quark workflow Joel Gwynn
- Re: Quark workflow Oleg Tkachenko
- RE: Quark workflow Joel Gwynn
- Re: incrementing variable xavier gibouin
- RE: incrementing variable Phil Dickinson
- Re: incrementing variable John Gentilin
- Re: incrementing variable Phil Dickinson
- Re: incrementing variable Oleg Tkachenko
- Re: incrementing variable xavier gibouin
- Re: incrementing variable J.Pietschmann