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

Subject: RE: [xsl] [XSLT 2.0] Creating a changeable globally scoped variable?
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sat, 20 Mar 2004 21:17:04 +0100
> -----Original Message-----
> From: Roger L. Costello
>
> I need to write a stylesheet which dynamically alters the value of a
> globally scoped variable.
>

Hi,

To keep it short: that is impossible.

I have quite a hard time trying to understand from your description what
exactly your requirements are, so it would be a big help if you could more
precisely describe what you are after...


> Some thoughts come to mind:
>
<snip />
>
> 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>
>

If it's something this simple, why not do for instance:

<xsl:variable name="i" select="document('vars.xml')/*/number[. > 0 and .
&lt;= 10]" />

Where the document vars.xml consists of nodes representing numbers, then
have a template matching them

<xsl:apply-templates select="$i" />
...
<xsl:template match="number">
  <xsl:value-of select="." />
</xsl:template>


Hope this gives you an idea...

Cheers,

Andreas


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


Current Thread