[xsl] [XSLT 2.0] Creating a changeable globally scoped variable?

Subject: [xsl] [XSLT 2.0] Creating a changeable globally scoped variable?
From: "Roger L. Costello" <costello@xxxxxxxxx>
Date: Sat, 20 Mar 2004 13:51:32 -0500
Hi Folks,

I need to write a stylesheet which dynamically alters the value of a
globally scoped variable.

Some thoughts come to mind:

1. Create a global variable with a value, and then dynamically change
the value.  Regrettably this is not allowed in 1.0 or 2.0.

2. Create a range variable with a sequence of values.  From reading the
specs this seemed promising.  Here's an example of how this might work:

   <xsl:template match="/">
      <xsl:value-of select="for $i in (1 to 10) return (ex:print())"/>
   </xsl:template>

   <xsl:function ex:print">
       <xsl:value-of select="$i"/>
   </xsl:function>

>From reading the specs I got the impression that the range variable ($i)
would have a scope over everything within "return (...)".  In my
example, within the return is a call to a function.  I was thinking that
the range variable's scope would extend to the ex:print function.  Alas,
it doesn't (unless there is a bug in SAXON).

I am out of ideas.  Is there any way to create a dynamically changeable
global variable?  /Roger


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread