xsl-list
[Top] [All Lists]

Re: [xsl] Is a variable referencing a node

2008-09-27 00:16:29
Please see,

http://www.dpawson.co.uk/xsl/sect2/bool.html#d3065e16

Please read the last line of this FAQ point, "Result tree fragments
are true because they always contain a 'root' node."

On Sat, Sep 27, 2008 at 7:00 AM, David Frey <dpfrey(_at_)shaw(_dot_)ca> wrote:
I have an XSLT 1 question.

Say I have:

<xsl:variable name="foo">
 <xsl:choose>
   <xsl:when test="$aVar='someFlag'">
     <xsl:value-of select="/path/to/some/element"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="/path/to/another/element"/>
   </xsl:otherwise>
</xsl:variable>
<xsl:choose>
 <xsl:when test="$foo">
   <xsl:value-of select="$foo"/>
 </xsl:when>
 <xsl:otherwise>--</xsl:otherwise>
</xsl:choose>



Currently, I never get "--" as my output even if $aVar is set to
'someFlag' and the element at "/path/to/some/element" does not exist.

Can someone explain where I went wrong?

Thanks,
David


-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--