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

Re: Global, dynamically-named variables (or equiv) in

Subject: Re: Global, dynamically-named variables (or equiv) in XSL
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 19 Jun 2003 20:55:14 +0100
dynamically named variables java

> is there an alternative way to accomplish this?

I don't think you said what this is, you gave an example of your input
document (an xsd fragment) but didn't say what you are transforming it
into, so it's hard to give any specific advice.

> The problem is that none of this works as I had hoped.  First off, it
> seems like I can't declare a variable that is named dynamically (based on
> the document being transformed)

This bit is true, in common with most other languages C, java, etc you
can't take strings from the input and make variable names out of them, 
variables are compile-time things they have to be recognised before the
input is seen.

<xsl:template match="xs:element">
  <xsl:value-of select="$@type"/>

I have a hard time guessing what effect you wanted from this but perhaps

<xsl:template match="xs:element">
 <xsl:apply-templates select="/xs:schema/*[self::xs:simpleType or self::xs:complexType][@name=current()/@name]"/>

which would apply templates to the type declaration with name given by
the @name attribute. You could make this more efficient by using a key,
but best to get something working without keys first I usually find.


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

Current Thread


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.
First Name
Last Name
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.