[xsl] Is a variable referencing a node

Subject: [xsl] Is a variable referencing a node
From: "David Frey" <dpfrey@xxxxxxx>
Date: Fri, 26 Sep 2008 17:30:13 -0800
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

Current Thread