[XML4Lib] XSLT call name of variable dynamically?

Walker, David dwalker at calstate.edu
Fri Feb 6 11:18:21 EST 2009


Thanks for all the responses, everyone!  My second approach is working well now -- sometimes sending a message to a listserv allows you to focus more clearly on what you've already done -- so I'm good.  But you've given me some other ideas for future stuff, so it was well worth the discussion.

--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 Erik Hetzner [erik.hetzner at ucop.edu]
Sent: Thursday, February 05, 2009 2:49 PM
To: xml4lib at webjunction.org
Subject: Re: [XML4Lib] XSLT call name of variable dynamically?

At Thu, 5 Feb 2009 12:58:01 -0800,
Walker, David wrote:
>
> Hopefully this makes sense:
>
> […]
>
> But I've had some problems with this approach. Need to figure it out,
> unless there is some better way I'm not thinking of?

Hi David -

Just re-read this message & realized that my previous message didn’t
cover your exact use case.

If you really want to do it like this, look at exslt:eval(...) [1].

Another way would be the basic method I outlined in the last message,
but with per-stylesheet variables:

<xsl:variable name="labels">
  <labels>
    <label name="text_breadcrumb_databases_categories" value="..."/>
  </labels>
</xsl:variable>

then use select="exslt:node-set($labels)//label[@name=$var]/@value"
(or something like that).

I’m still not sure why you need per-page overrides for label text, but
it could be done like this.

best,
Erik Hetzner

1. http://www.exslt.org/dyn/functions/evaluate/index.html



More information about the XML4Lib mailing list