You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by hg...@cswebmail.com on 2003/03/21 13:55:10 UTC

XSL and script code - please help

Hi all,
 
I am currently developing a histogram (svg) to be
included in the Cocoon portal.
The current solution for generation of the SVG code is
XSL only. 

Now I would like to add an algorithm for
y-axis autoscaling (see 'pseudocode' below). I am not
sure how to do this in pure XSL e.g. 

-is there a fract() function ? I know that a floor
function exists. 

- But what about the loop ?

- What about passing variables to this code (and
getting them back into the XSL script) ?

- Do I need further (script-)extensions to XSL to do
this ?

Best regards,

Holger

*******************************************

iReg=1;

regA=10**floor((max-min)/#-of-tics);

<top loop>

iReg++;

reg9=regA*floor(min/regA);

reg8=reg9+#-of-tics*regA;

if(max>reg8){		(would exit the loop if <=)

if(fract(iReg/4)==0)

{regA=1.25*regA;}

else

{regA=2*regA;}

{

<bottom loop>

*********************************************

___________________________________________________
The ALL NEW CS2000 from CompuServe
 Better!  Faster! More Powerful!
 250 FREE hours! Sign-on Now!
 http://www.compuserve.com/trycsrv/cs2000/webmail/





---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: XSL and script code - please help

Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Holger,

there is an extension library for XSLT written by Dimitre Novatchev. You 
can find it at http://fxsl.sourceforge.net/. It contains for example 
trigonometric functions.
And if you really need XSLT for such an extreme logic, you can ask him - 
I'm sure he can help you with implementing the algorithm. But consider 
that XSLT was created for transforming XML trees into trees, not for 
calculating complex algorithms.

Regards,

Joerg

hgadm@cswebmail.com wrote:
> Hi all,
>  
> I am currently developing a histogram (svg) to be
> included in the Cocoon portal.
> The current solution for generation of the SVG code is
> XSL only. 
> 
> Now I would like to add an algorithm for
> y-axis autoscaling (see 'pseudocode' below). I am not
> sure how to do this in pure XSL e.g. 
> 
> -is there a fract() function ? I know that a floor
> function exists. 
> 
> - But what about the loop ?
> 
> - What about passing variables to this code (and
> getting them back into the XSL script) ?
> 
> - Do I need further (script-)extensions to XSL to do
> this ?
> 
> Best regards,
> 
> Holger
> 
> *******************************************
> 
> iReg=1;
> 
> regA=10**floor((max-min)/#-of-tics);
> 
> <top loop>
> 
> iReg++;
> 
> reg9=regA*floor(min/regA);
> 
> reg8=reg9+#-of-tics*regA;
> 
> if(max>reg8){		(would exit the loop if <=)
> 
> if(fract(iReg/4)==0)
> 
> {regA=1.25*regA;}
> 
> else
> 
> {regA=2*regA;}
> 
> {
> 
> <bottom loop>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org