xsl-list
[Top] [All Lists]

Re: Making XPath expressions out of variables

2003-10-29 08:46:35
<xsl:for-each select="//$record-type">
<xsl:sort select="$sort-by" order="$sort-order" />
<xsl:if test="$lh-operator $operand $rh-operator">
<tr>
  <xsl:for-each select="*">
<td><xsl:value-of select="." /></td>
</xsl:for-each>
</tr>
</xsl:if>
</xsl:for-each>

Any ideas? Is it possible? Or do I need to use this basic construct
multiple
times using <xsl:if> for each variable and the correct names of nodes and
operands. (The number of permutations is massive!)

Using FXSL one can write in (XSLT2):

      <xsl:if test="f:apply($operator, $lh-operand,  $rh-operand)">
              .   .   .   .   .   .   .   .
      </xsl:if>

in XSLT 1.0 this will be written as:

     <xsl:variable name="vResult" >
        <xsl:apply-templates select="$operator">
            <xsl:with-params name="arg1" select="$lh-operand"/>
            <xsl:with-params name="arg2" select="$rh-operand"/>
        </xsl:apply-templates>
     </xsl:variable>
     <xsl:if test="$vResult">
              .   .   .   .   .   .   .   .
      </xsl:if>



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL





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