This question was a hot topic for debate a while back, so I'm not surprised
that you're perplexed by it.  Here's the relevant section from the
recommendation:

   http://www.w3.org/TR/xslt#section-Result-Tree-Fragments

   "A result tree fragment represents a fragment of the result tree. A
   result tree fragment is treated equivalently to a node-set that contains
   just a single root node."

Since a result tree fragment always has a "conceptual" root node, it's
never empty, so boolean($rtf) always returns true.

Hope that helps...

Dave



                                                                                       
      
                    Tom Amiro                                                          
      
                    <Tom.Amiro@Su        To:     "[EMAIL PROTECTED]"            
      
                    n.COM>               <[EMAIL PROTECTED]>                    
      
                                         cc:     (bcc: David N Bertoni/CAM/Lotus)      
      
                    07/11/2001           Subject:     test boolean43 seems wrong       
      
                    08:43 AM                                                           
      
                    Please                                                             
      
                    respond to                                                         
      
                    xalan-dev                                                          
      
                                                                                       
      
                                                                                       
      



I've puzzled over conf test boolean43 and can't figure out why
the expected result of "true" is correct. Note the xml doc does not
have a "foo" element. Indeed, Xalan, XT,  and Saxon return
"true" on this test. XSLTC returns "false". We're outnumbered,
but it looks to me like "false" is the correct answer.

Here's the xsl

  <xsl:variable name="emptyResultTreeFragTest">
    <xsl:value-of select="foo"/>
  </xsl:variable>

  <xsl:template match="doc">
    <out>
      <xsl:value-of select="boolean($emptyResultTreeFragTest)"/>
    </out>
  </xsl:template>

I checked the string-length of  the "emptyResultTreeFragTest"
variable and it was 0. I also explicitly converted it to a string
with the string function and printed it out. That showed an
empty string.

So I don't see how applying the boolean function to the variable
can return "true". The XSLT spec says a node-set is true only
if it is non-empty and that a string is true if and only if its
length is non-zero.

What am I missing?

Tom







Reply via email to