xslt eval concat xpath

W

webjay

Hello.

I need to select a Xpath that consists of a path plus a variable.
Like this:
<xsl:value-of select="concat($path, $num)" />
The above will return the concatenated string and not the value from
the xpath.

So I guess I need something like <xsl:value-of
select="eval(concat($path, $num))" /> but can not make it work.

Any ideas?

/jacob
 
P

Pavel Lepin

webjay said:
I need to select a Xpath that consists of a path plus a
variable. Like this:
<xsl:value-of select="concat($path, $num)" />
The above will return the concatenated string and not the
value from the xpath.

So I guess I need something like <xsl:value-of
select="eval(concat($path, $num))" /> but can not make it
work.

You can't do that with XSLT1. EXSLT provides dyn:evaluate(),
but it's non-standard. Therefore processor support may
vary, up to and including blowing up your freezer when you
try to invoke it.

Please note that a need for eval() often indicates a design
problem or taking the wrong turn while trying to solve your
actual problem. If you restated your problem in terms
of 'what-I-need-to-achieve' instead
of 'what-functionality-I-need-in-the-language' denizens of
the group might be able propose a more elegant solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top