RE: Minor problem with ircgi in VXML test suite

Thanks for your feedback and for supplying a fix, Andras.

In spite of the fact that GNOME's (xsltproc) implementation is the only
one of the four XSLT processors that I've tested that treats a missing
attribute and an attribute with a empty value as this same, section 11.2
of the XSLT 1.0 spec corroborates GNOME's implementation:

<excerpt/>
  If the variable-binding element has empty content and does not have a
select attribute, then the value of the variable is an empty string.
Thus

<xsl:variable name="x"/>
is equivalent to

<xsl:variable name="x" select="''"/>

<excerpt/>

Other processors tested: 
  Microsoft (MSXML 4.0) 
  GingerAll (Sablotron 0.96)
  javax.xml.transform (Sun ??)
  
I'll plug the fix into ircgi2pl.xslt. I don't anticipate, however, that
it will get published to the W3C site for a while though.

Matt
-----Original Message-----
From: www-voice-request@w3.org [mailto:www-voice-request@w3.org] On
Behalf Of Andras Micsik
Sent: Monday, April 28, 2003 5:10 AM
To: www-voice@w3.org
Subject: 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 12:36:49 UTC