xsl-list
[Top] [All Lists]

Re: 'xsl:variable' as dynamic select for 'xsl:for-each'...

2003-11-17 06:03:50
At 12:15 17/11/2003 +0000, you wrote:

Of course, this doesn't work either...

    <xsl:variable name="selectclause">
      <xsl:choose>
        <xsl:when test="$clientid = ''">"//client"</xsl:when>
        <xsl:otherwise>"//client[$clientid]"</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

use:
<xsl:when test="$clientid = ''"><xsl:copy-of select="//client"/></xsl:when>



and then, your for-each will work fine.

  <xsl:for-each select="$selectclause">
        my code
  </xsl:for-each>

Perhaps :
<xsl:for-each select="$selectclause/*">
        my code
</xsl:for-each>

It depends on your code.

This will work with Saxon and version="1.1"
Otherwise, use the function nodeset() :

<xsl:for-each select="nodeset($selectclause)/*">
etc.

Regards
Ph D


==
Philippe Drix
     ___________
__| OBJECTIVA |___________________
http://www.objectiva.fr
21-23, rue Aristide Briand - 92170 Vanves
tel : +33 1 47 36 60 30
cel :      06 74 78 34 97
fax : +33 1 47 36 61 93



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