This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29222 - [XT30] function-1501 tests existing environment variables by checking against the empty string
Summary: [XT30] function-1501 tests existing environment variables by checking against...
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 Test Suite (show other bugs)
Version: Last Call drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Abel Braaksma
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-22 03:32 UTC by Abel Braaksma
Modified: 2015-10-22 15:57 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2015-10-22 03:32:51 UTC
The test uses the following to test whether any item from fn:available-system-variables() exists or not:

  <xsl:if test="environment-variable(.) =''" >
     false
  </xsl:if> 

It is possible to have environment variables that return an empty string. In fact, the FO30 spec says that if an env variables does not exist, it should return the empty sequence.

I propose to fix this test by testing for emptiness instead.
Comment 1 Michael Kay 2015-10-22 14:21:42 UTC
Agreed. I have rewritten the test to read:

<xsl:value-of select="
    every $s in ('user', 'USER', 'shell', 'SHELL', 'path', 'PATH', 'zzz', '', '%$£*!') satisfies
          if (available-environment-variables() = $s) 
          then exists(environment-variable($s)) 
          else empty(environment-variable($s))"/>
Comment 2 Michael Kay 2015-10-22 14:31:35 UTC
I have similarly rewritten function-1601
Comment 3 Abel Braaksma 2015-10-22 15:57:18 UTC
Thanks. I also rewrote it, I will check if I inadvertently overwrote your changes...