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

RE: Accessing variable with computed name

Subject: RE: Accessing variable with computed name
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 9 Dec 2003 20:00:55 -0000
table frame box
> 
> how do I access the contents of a variable (or param) whose 
> name is computed?

Same way as you do it in C or Java. In other words, you don't.

Instead of having two parameters called table.frame.void and
table.frame.box, have one parameter, which is a tree containing elements
with these names. Then you can use XPath to find the right value in the
tree.

Michael Kay


> 
> Pseudo-code for demonstration, NOT WORKING:
> 
> ...
> <xsl:param name="table.frame.void">border: none;</xsl:param> 
> <xsl:param name="table.frame.box">border: 1pt solid 
> black;</xsl:param> ...
> 
> <xsl:template match="table">
>   <table style="{$table.frame.{@frame}}"> <!-- ### -->
>   ...
> </xsl:template>
> 
> 
> What I intend here is to compute the name of the variable to 
> be accessed using some constant prefix ('table.frame.') and 
> the contents of the element's 'frame' attribute.
> 
> Nested {...}'s are not allowed, and some other attempts of 
> mine did not work (like "{concat( '$table.frame.', @frame)}").
> 
> Regards, Christian.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.