xsl-list
[Top] [All Lists]

Re: Retaining value of a Global variable

2004-07-17 00:59:59
Hi vivek,

For making a variable global u have to use some
scripting languafe like javascript or jscript and then
use getter, setter method. You pass the variable value
to a javascript function which has a global variable.

Then u call the getter funtion somwhere in the
stylesheet where the global variable of javascript is
returned 

It looks something like this...

<xalan:script lang="javascript">
<![CDATA[

//Function to set Package name
var sendpname;
function sendpackagename(finpackagename)
{
sendpname=finpackagename;
return sendpname;
}

//Function to get Package name
function returnpackagename(getpackagename)
{
return sendpname;
}

  ]]>
    </xalan:script>
  </xalan:component>


In the xsl part...
....
....
<!--inside a Loop-->
<xsl:variable name="sendpackagename"
select="counter:sendpackagename(string($finpackagename))"/>
<!--Loop ends-->
....
....
<!--outside loop or anywhere in the code-->
....
<xsl:variable name="getpackagename"
select="counter:returnpackagename(string(getpackagename))"/>
....

Now you can use the variable getpackagename which has
the value 'retained'. But this is cumbersome, i.e. you
have to use many number of such getter, setter
functions to kkep on retaining the old values and
using them through out the code.....

hope it helps.

bye,
with regards,
Deepak.


                
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/