xsl-list
[Top] [All Lists]

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

2004-03-20 13:17:04
-----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



<Prev in Thread] Current Thread [Next in Thread>