[xsl] Something like eval()? and Thanks!

Subject: [xsl] Something like eval()? and Thanks!
From: "McKeever, Marty" <marty.mckeever@xxxxxxxxxxxxxxxxx>
Date: Wed, 07 Nov 2001 09:35:05 -0500
Thanks to all who offered solutions to my multile match-->single output
problem.  I have much to ponder over the weekend and am sure i will learn
alot.  Apparently it was more difficult than i'd hoped, so i dont feel
"quite" as dumb for not finding the solution quickly.

Now, for an even crazier idea.
Is there any way to force a string of the format "$foo" to evaluate into the
matching parameter named $foo.  
I've looked for an extension function that would do this with no luck.
Surely something exists.

The scenario:
XML Input: <a href="foo.htm?custID=$custID">My Account</a>
And passing an external parameter for $custID (23456)

I can easily search & replace the custID=$custID with the value of the
parameter, IF i already know that "custID" is what needs to be matched.

What i'm hoping for is a more generic parameter matching system, where my
XML might look like:
<a href="foo.htm?custID={$custID}">My Account</a>
and i could do the following:

<xsl:variable name="flagged">
<xsl:if test="contains(@href,'{$')">
  <xsl:value-of select="substring-after(substring before(@href,'}'),'{$')"/>


to extract the name of my matching variable from the href, then call my
replace template with this value evaluated into the matching parameter:

<xsl:call-template name="replace">
<xsl:with-param name="inputString" select="@href">
<xsl:with-param name="changeFrom" select="concat('{$',$flagged,'}')">
<xsl:with-param name="changeTo" select="EVAL(concat('$',$flagged))">

Am i crazy for thinking this might work?  
Or am i clueless and missing the point?

Thanks again -- you guys rock!


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

Current Thread