Can not expand NS prefix to URI for decimal-format #2

Bug #1167641 reported by Paul J. Lucas
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Committed
Medium
Sorin Marian Nasoi

Bug Description

The FOTS test numberformat87:

  (: This test declares the following in its environment: xmlns:a="http://a.ns/" :)
  declare decimal-format a:test decimal-separator="," grouping-separator=".";

  format-number( 12.34, "0.000,00", "Q{http://a.ns/}test " )

causes Zorba to yield the error:

  "a": can not expand namespace prefix to URI

Does Zorba handle Q{}-style QNames?

Related branches

summary: - Can not expand NS prefix to URI for decimal-format
+ Can not expand NS prefix to URI for decimal-format #2
Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Either this bug or bug #1167643 also affects FOTS test numberformat88.

Changed in zorba:
assignee: Dana Florescu (dflorescu) → Paul J. Lucas (paul-lucas)
milestone: none → 2.9
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

The test case mentions the environment:
[...]
<environment>
  <decimal-format xmlns:a="http://a.ns/" name="a:test" decimal-separator="," grouping-separator="."/>
</environment>
[...]

and in the query composed by the FOTS driver the mentioned environment translates to:
[...]
declare decimal-format a:test decimal-separator="," grouping-separator="." ;
[...]

Changed in zorba:
assignee: Paul J. Lucas (paul-lucas) → Sorin Marian Nasoi (sorin.marian.nasoi)
tags: added: fots-driver
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

IN the attached branch the FOTS driver now translates:
<environment>
  <decimal-format xmlns:a="http://a.ns/" name="a:test" decimal-separator="," grouping-separator="."/>
</environment>

to the following prolog declaration:
declare decimal-format Q{http://a.ns/}test decimal-separator="," grouping-separator="." ;

However this did not fix the 3 failures ("numberformat83", "numberformat87" and "numberformat88") because the code in the fn:format-number iterator assumes the type of the name to be xs:QName instead of EQName as defined in the DecimalFormatDecl spec.

As a result the query:

xquery version "3.0";
declare decimal-format Q{http://a.ns/}test decimal-separator="," grouping-separator="." ;
format-number(12.34, '0.000,00', 'Q{http://a.ns/}test ')

raises [err:FODF1280]: "Q{http://a.ns/}test": invalid decimal format name for fn:format-number()
I reassigned lp:1167641 back to Paul to fix the code in fn:format-number.

Also I marked bug lp:1167643 as a duplicate of bug lp:1167641.

Changed in zorba:
assignee: Sorin Marian Nasoi (sorin.marian.nasoi) → Paul J. Lucas (paul-lucas)
Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Except I didn't write the code in format-number() that deals with QNames -- I just cleaned it up. I have no idea how to do this. A little help?

Revision history for this message
Nicolae Brinza (nbrinza) wrote :

I'll commit a fix soon.

Changed in zorba:
assignee: Paul J. Lucas (paul-lucas) → Nicolae Brinza (nbrinza)
Changed in zorba:
importance: Undecided → Medium
milestone: 2.9 → 3.0
Chris Hillery (ceejatec)
Changed in zorba:
status: New → Confirmed
Revision history for this message
Chris Hillery (ceejatec) wrote :

Sorin - it appears that the change you made to the FOTS driver does not actually do what you said it does, or at least that is not what is reported in the driver output:

3687: <test-case xmlns="http://www.w3.org/2010/09/qt-fots-catalog" name="numberformat87" result="pass" info="Test case failed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt">
3687: <environment>
3687: <decimal-format xmlns:a="http://a.ns/" name="a:test" decimal-separator="," grouping-separator="."/>
3687: </environment>
3687: <test><![CDATA[format-number(12.34, '0.000,00', 'Q{http://a.ns/}test ')]]></test>
3687: <result>
3687: <assert-string-value>0.012,34</assert-string-value>
3687: </result>
3687: <fots:info>
3687: <fots:query><![CDATA[
3687: import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';
3687:
3687: variable $queryID := xqxq:prepare-main-module
3687: (
3687: '
3687: xquery version "3.0";
3687: declare base-uri "file:///home/ceej/zo/src/build/test/fots/2011/QT3-test-suite/fn/format-number.xml";
3687: declare decimal-format a:test decimal-separator="," grouping-separator="." ;
3687: format-number(12.34, ''0.000,00'', ''Q{http://a.ns/}test '')
3687: '
3687:
3687: );

Note that the "declare decimal-format" in the generated query still says "a:test". It appears that this is why the test is currently failing, at least.

Can you verify/fix the FOTS driver behaviour?

Changed in zorba:
assignee: Nicolae Brinza (nbrinza) → Sorin Marian Nasoi (sorin.marian.nasoi)
Changed in zorba:
status: Confirmed → In Progress
Changed in zorba:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.