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

Reply via email to