Re: Global, dynamically-named variables (or equiv) in
> 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"/> </xsl:template> 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]"/> </xsl:template> 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. David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format