Minor problem with ircgi in VXML test suite

Hi,

we found that assertion 1 always fails, and the cause is faulty Perl
code generated with ircgi2pl.xslt using xsltproc. Might be the case that
xsltproc is not 100% compliant to the XSL recommendation..., but anyway
there is a workaround:

The problematic excerpt:

  <if-header name="User-Agent">
    <if-header name="User-Agent" value="" >
      <comment>
        User-Agent header present, but empty.
      </comment>

The generated Perl code excerpt:

  $val = $ENV{HTTP_USER_AGENT};

  if (defined($val) && ($val =~ /^\s*$/)) {

    $val = $ENV{HTTP_USER_AGENT};

    if (defined($val) && ($val =~ /^\s*$/)) {

      push @comments, qq {
        User-Agent header present, but empty.
      };
.... and finally, it says that User-Agent was not supplied...

The first if-header tag is processed the same way as the second. This is
because <xsl:when test="$value=''"> is true when value parameter is
missing.

So here is the modified part of ircgi2pl.xslt, which works well even with
xsltproc:

...
<xsl:when test="$value">
  <xsl:choose>
   <xsl:when test="$value=''">
    if (defined($val) &amp;&amp; ($val =~ /^\s*$/)) {
      <xsl:apply-templates/>
    }
   </xsl:when>
   <xsl:otherwise>
      my $match = '<xsl:value-of select="$value"/>';
      if (defined($val) &amp;&amp; ($val =~ /^$match$/<xsl:if test="$ignore-case='true'">i</xsl:if>)) {
       <xsl:apply-templates/>
      }
   </xsl:otherwise>
  </xsl:choose>
</xsl:when>
<xsl:otherwise>
  if (defined($val)) {
    <xsl:apply-templates/>
  }
</xsl:otherwise>
...


----------------------------------------------------
 András Micsik          MTA SZTAKI Hungary
 http://www.sztaki.hu/~micsik

Received on Monday, 28 April 2003 08:10:42 UTC