This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: treat a string into a variable name
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] treat a string into a variable name
- From: Mike Brown <mike at skew dot org>
- Date: Fri, 5 Jan 2001 17:50:21 -0700 (MST)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Pouliot, Brian R. wrote:
> <xsl:variable name="temp">$day<xsl:value-of select="$n"/>date</xsl:variable>
>
> Now, I need to use $temp to access the actual variables. Is this possible?
> I'm having a terrible time with it! $temp == "$day1date". How do get the
> value of the variable named by the string inside $temp?
No, it's not possible. All variable references in XSLT must explicitly spell
out the name of the variable; you can't calculate it.
In Perl you'd just do ${$temp}. Frustrating, isn't it?
What is the problem you are trying to use this approach to solve? There might
be another way.
- Mike
____________________________________________________________________
Mike J. Brown, software engineer at My XML/XSL resources:
webb.net in Denver, Colorado, USA http://skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list