Thanks for the help. <xsl:value-of select="*[name() = $col1-select]"/> works without having to use any extension functions (like "nodeset($root)").
Scott BTW - "xalan:nodeset($root)" and "xalan:evaluate($col1-select)" does NOT work. Although I didn't mention it in my original email, I have tried that route. nodeset() doesn't cause a problem, but evaluate() gives this error in Xalan 2 R11: (Location of error unknown)XSLT Error javax.xml.transform.TransformerException): null -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, November 02, 2001 12:53 PM To: Scott Moore Cc: Xalan-J-Users (E-mail) Subject: Re: Help! Using variables in for-each Hi Scott. Your <xsl:value-of select="$col1-select"/> is simply selecting the string value of the variable reference, as it is supposed to do. > I've tried lots of different expressions > > "{$col1-select}" Only attributes specified in the XSLT specification as attribute value templates will accept {xxx}. select and test attributes are not among them. The bottom line is that XPath expressions can not be dynamically evaluated. Probably your best bet is: <xsl:value-of select="*[name() = $col1-select"/> -scott Scott Moore <[EMAIL PROTECTED] To: "Xalan-J-Users (E-mail)" <[EMAIL PROTECTED]> ecide.com> cc: (bcc: Scott Boag/CAM/Lotus) Subject: Help! Using variables in for-each 11/02/2001 12:35 PM I'm trying to write a template in xalan that takes a result tree fragment ($root) along with the names of child elements ($col1-select and $col2-select). This template would then dynamically create a XSL-FO table based on the variables passed in. The template looks something like this: <xsl:template name="table-body"> <xsl:param name="root"/> <xsl:param name="col1-select"/> <xsl:param name="col2-select"/> <fo:table-body> <xsl:for-each select="$root"> <fo:table-row> <fo:table-cell> <fo:block><xsl:value-of select="$col1-select"/></fo:block> </fo:table-cell> <xsl:if test="string-length($col2-select) > 0"> <fo:table-cell> <fo:block><xsl:value-of select="$col2-select"/></fo:block> </fo:table-cell> </xsl:if> </fo:table-row> </xsl:for-each> </fo:table-body> </xsl:template> <xsl:call-template name="table-body"> <xsl:with-param name="root" select="/Session/Values"></xsl:with-param> <xsl:with-param name="col1-select">node1</xsl:with-param> <xsl:with-param name="col2-select">node2</xsl:with-param> </xsl:call-template> It doesn't work. Instead of treating $col1-select as a XPath expression, it just adds the literal string. I've tried lots of different expressions "{$col1-select}" "./$col1-select" "self:node()/[name()=$col1-select]" blah blah Is this possible? I think it's probably something simple, but I just can't figure it out. Thanks for any help, Scott
