Re: [xsl] Variable of variable

Subject: Re: [xsl] Variable of variable
From: Paul Prescod <paulp@xxxxxxxxxxxxxxx>
Date: Mon, 09 Jul 2001 01:46:12 -0700
Frederic Bruneteau wrote:
> 

> I use xalan to transform XML to SVG

By the way, I'm looking for help in collecting some "patterns" in XSLT
to SVG processing. I'm looking to build up an open cookbook of XSLT
recipes and SVG is a particularly interesting new area. Do you think you
have any you could contribute from your current project? This is an open
question for anyone on the list. FO is also something that I could use
help with.

>...
>         ${$col1}
> but xalan doesn't accept these syntaxes !!!
> 
> Do you know how to access to a variable of a variable ?
>...

I don't think it is possible. There are really very few programming
languages where it *is* possible and even in those ones it isn't easy.
Variable names are just labels for places that store information. They
aren't first-class objects that you should be manipulating in your
programs. There must be another way to solve the same problem. If you
explain the underlying problem, we might be able to help you find a
solution that doesn't involve "meta-variables." For instance here's one
idea:

<xsl:choose>
  <xsl:variable name="col-val">
    <xsl:when test="$col='HOUR'"/>
       <xsl:value-of select="$HOUR"/>
    </xsl:when>
    <xsl:when test="$col='DAY'"/>
       <xsl:value-of select="$DAY"/>
    </xsl:when>
</xsl:choose>

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook

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


Current Thread