[xsl] Variable containing tree

Subject: [xsl] Variable containing tree
From: "Filipe Correia" <filipe.correia@xxxxxxxxxxxxxxx>
Date: Fri, 07 Jun 2002 09:49:17 +0100
  Hi,

I'm assigning a set of nodes to a variable like this:

      <xsl:variable name="var">
         <xsl:apply-templates/>
      </xsl:variable>

wich I would like to output later on only if the variable is not empty.
I've tried outputing it like this:

   <xsl:if test="$restFormElements != '' ">
      <result>
         <xsl:apply-templates select="$restFormElements"/>
      </result>
   </xsl:if>

but the test is never true. I'm not sure how to test this...
But beyond the test part... If I just try to output my variable:

         <xsl:apply-templates select="$restFormElements"/>

xalan exits with an exception: "Can not convert #RTREEFRAG to a NodeList!"
so I tried to convert the tree fragmente to a node list using xalan's built in "nodeset()"
function. like this:

         <xsl:apply-templates select="xalan:nodeset($restFormElements)"/>

but I only get the the resulting tree's root node...  and not the entire tree as I was expecting.

How is this behavior explained?


   thks in advance!

        Filipe


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


Current Thread