[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Using XSLT for multi-agent simulation [was Creatin

Subject: RE: Using XSLT for multi-agent simulation [was Creating a changeable globally scoped variable?]
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sun, 21 Mar 2004 20:51:33 +0100
creatin
> -----Original Message-----
> From: Roger L. Costello [mailto:costello@xxxxxxxxx]
>
<snip />
> In order for the Agent Processing code to apply the Movement Rule
> to each agent it will need to modify the value of a global
> variable. Let's see why this is the case.
>
<snip />

Hi,

It seems to me that the 'current-cell' is not (or does not necessarily have
to be) a 'global' variable, or at least, a remote possibility could be to
gather all cells in a node-set variable at a higher level and pass it in as
parameter to the Agent-Processing Template(?)

Pseudo-code like:

<xsl:variable name="vcells" select="???" />
...
<xsl:call-template name="Agent-Processing">
  <xsl:with-param name="pcells" select="$vcells" />
</xsl:call-template>
...
<xsl:template name="Agent-Processing">
  <xsl:param name="pcells" />

  <xsl:for-each select="$pcells/cell">
    <xsl:call-template name="Agent-Movement-Rule" />
  </xsl:for-each>
</xsl:template>
...

Of course, this would depend on the relationship between the $num-agents in
the select expression of your for-each and the $current-cell variable. Is it
possible to sort it out at a higher level in the tree, *before* the
Agent-Processing template is called? If so, an approach like this would make
your life much easier, I think... Same goes for the Agent-Movement-Rule
template: equip it with an xsl:param and pass the current cell in through
there.

<snip />
> This template needs to dynamically alter the global variable.
>

It seems that you are struggling more with the scope of the variable in
question than with the need of its being mutable. In any case, both sides
can be dealt with by using parameters... the parameter being passed in is
always in scope for the current template, and can be modified to make it
depend upon a higher-level condition.


Hope this helps!

Cheers,

Andreas

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.