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 3135 - fn-prefix-from-qname-3 should use fn:string-length, not fn:count
Summary: fn-prefix-from-qname-3 should use fn:string-length, not fn:count
Status: VERIFIED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.9.0
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Andrew Eisenberg
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-21 14:12 UTC by Alberto Massari
Modified: 2006-06-21 09:44 UTC (History)
0 users

See Also:


Attachments

Description Alberto Massari 2006-04-21 14:12:23 UTC
The query 

fn:count(fn:string(fn:prefix-from-QName(xs:QName("name"))))

wants to check that prefix-from-QName returns an empty sequence; but creating a string from an empty sequence returns a string of zero length, and fn:count will return 1 (as its argument is a sequence of 1 empty string).

In order to get the desired 0 value, the query should either be

fn:string-length(fn:string(fn:prefix-from-QName(xs:QName("name")))

or

fn:count(fn:prefix-from-QName(xs:QName("name")))
Comment 1 Carmelo Montanez 2006-04-21 14:25:29 UTC
Alberto:

You are correct.  re-wrote the query to use your second suggestion of
"fn:count(fn:prefix-from-QName(xs:QName("name")))"

Please close the bug if in agreement.

Thanks,
Carmelo
Comment 2 Alberto Massari 2006-04-21 14:29:44 UTC
Hi Carmelo,
the same problem should appear also in fn-prefix-from-qname-4, where the only difference is that xs:string is used instead of fn:string
Comment 3 Alberto Massari 2006-06-14 18:37:03 UTC
fn-prefix-from-qname-3 has been changed, but the expected result is 1, while the correct one is 0 (prefix-from-QName returns an empty sequence because the prefix is missing).

fn-prefix-from-qname-4 has not been updated, and it still contains

  fn:count(xs:string(fn:prefix-from-QName(xs:QName("name"))))

As changing it by removing xs:string would make it identical with fn-prefix-from-qname-3, it could be changed into

  fn:string-length(xs:string(fn:prefix-from-QName(xs:QName("name")))
  
Comment 4 Carmelo Montanez 2006-06-14 20:26:59 UTC
Alberto:

Correct, I did change the expected results for fn-prefix-from-qname-3 and
changed fn-prefix-from-qname-4 as suggested.  I did notice though that these tests are under "Expressions" rather than under "Functions".  I will try to make that move later for the 1.0 version.  Please close the bug if in agreement.

Thanks,
carmelo