Hi Scott, The best forum for a question like this is the Mulberry XSL list, since it's not Xalan-specific. You should consider subscribing to that list and posting general XSL questions there:
http://www.mulberrytech.com/xsl/xsl-list/index.html This question is answered in the XSL List FAQ. In standard XSLT 1.0, there is no way to dynamically evaluate an XPath expression. You can use the Xalan extension function evaluate() to do this, but it makes your stylesheet non-standard. Also, if $root is truly a result tree fragment, you need to use the nodeset () extension function to convert it to a node set in the select attribute of the xsl:for-each. Dave Scott Moore <[EMAIL PROTECTED] To: "Xalan-J-Users (E-mail)" ecide.com> <[EMAIL PROTECTED]> cc: (bcc: David N Bertoni/CAM/Lotus) 11/02/2001 12:35 Subject: Help! Using variables in for-each 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
