W3C home > Mailing lists > Public > www-voice@w3.org > April to June 2003

Minor problem with ircgi in VXML test suite

From: Andras Micsik <micsik@dsd.sztaki.hu>
Date: Mon, 28 Apr 2003 14:10:29 +0200 (MET DST)
To: <www-voice@w3.org>
Message-ID: <Pine.GSO.4.33.0304281356040.26585-100000@samson>


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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 30 October 2006 12:48:58 GMT