[XML4Lib] XSLT call name of variable dynamically?

Walker, David dwalker at calstate.edu
Thu Feb 5 16:08:50 EST 2009


Thanks, Roy.  This is essentially what I'm doing now -- I was hoping for some kind of shortcut, since I've got a _lot_ of variables, and I'd rather not write out a whole bunch of <xsl:if> or <xsl:when> statements.

--Dave

==================
David Walker
Library Web Services Manager
California State University
http://xerxes.calstate.edu
________________________________________
From: xml4lib-bounces at webjunction.org [xml4lib-bounces at webjunction.org] On Behalf Of Roy Tennant [tennantr at oclc.org]
Sent: Thursday, February 05, 2009 12:16 PM
To: xml4lib at webjunction.org
Subject: Re: [XML4Lib] XSLT call name of variable dynamically?

I'm not sure if this is what you want to do or not, but in one of my
stylesheets I have:

<xsl:variable name="abstract" select="print/cite/abstract"/>

Then later I test for it's existence:

<xsl:if test="$abstract"> - <xsl:apply-templates select="abstract"/>
....

So I _think_ if you first have a statement that declares the variable and
loads it up, then your statement might work. But then, what do I know?
Roy


On 2/5/09 2/5/09 € 12:00 PM, "Walker, David" <dwalker at calstate.edu> wrote:

> Hi all,
>
> Is it possible in XSLT 1.0 to call an <xsl:variable> dynamically at run-time
> without using an <xsl:choose> block?  That is, something like this:
>
>    <xsl:value-of select="${$foo}" />
>
> That doesn't work.  But is there some other way to accomplish the same?  If
> need be, I can write some background on this question, but hoping someone
> might be able to tell me straight-up.
>
> --Dave
>
> ==================
> David Walker
> Library Web Services Manager
> California State University
> http://xerxes.calstate.edu
>
> _______________________________________________
> XML4Lib mailing list
> XML4Lib at webjunction.org
> http://lists.webjunction.org/mailman/listinfo/xml4lib
>

--



_______________________________________________
XML4Lib mailing list
XML4Lib at webjunction.org
http://lists.webjunction.org/mailman/listinfo/xml4lib



More information about the XML4Lib mailing list