XML : XSLT boolean of an empty string prints true

Here is my xslt. Any reason why boolean($x) prints true when boolean($y) prints false when they both have the same value. the only difference is that x gets its empty string by calling a template.

  <?xml version="1.0" encoding="UTF-8"?>  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">      <xsl:template match="/">      <xsl:variable name="x">        <xsl:call-template name="tmplate"></xsl:call-template>      </xsl:variable>        ###x-bool:[<xsl:value-of select="boolean($x)"/>]      ###x:[<xsl:value-of select="$x"/>]        <xsl:variable name="y" select="''"/>      ###y-bool:[<xsl:value-of select="boolean($y)"/>]      ###y:[<xsl:value-of select="$y"/>]      </xsl:template>      <xsl:template name="tmplate">      <xsl:value-of select="''"/>    </xsl:template>  </xsl:stylesheet>    

No comments:

Post a Comment