[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Something like eval()? and Thanks!

Subject: Something like eval()? and Thanks!
From: "McKeever, Marty" <marty.mckeever@xxxxxxxxxxxxxxxxx>
Date: Wed, 07 Nov 2001 09:35:05 -0500
eval xsl concat
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,'}'),'{$')"/>

</xsl:if>
</xsl:variable>

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))">
</xsl:call-template>

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

Thanks again -- you guys rock!

Marty

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.