I can't execute a xquery with fn:current-date()

Hello!!!

I need to execute this x-query in x-plorer :

declare namespace fn=“W3C XQuery 1.0 and XPath 2.0 Functions and Operators
declare namespace xs=“XML Schema

                            <dateIni>{xs:date('2005-12-12')}</dateIni>
                         
                            <dateFin>{xs:date(fn:current-date())}</dateFin>  

I’ve used different namespaces:
http://www.w3.org/2002/08/xquery-functions
http://www.w3.org/2004/10/xpath-functions
http://www.w3.org/2005/02/xpath-functions

but always I obtain the same error:

“INOXQE6358: Function unknown Function: http://www.w3.org/2004/10/xpath-functions:current-date; line 11, column 51: <![CDATA[fn:current-date())} ]]>”

The Tamino documentation says:

“These functions are all based on the W3C draft specification XQuery 1.0 and XPath 2.0 Functions and Operators as of October 29, 2004.”

In that page, I found W3C XQuery 1.0 and XPath 2.0 Functions and Operators.

So, my question is… I’m using this function in the right way?

In Altova, “fn:current-date()” hasn’t problem with the namespace “W3C XQuery 1.0 and XPath 2.0 Functions and Operators”, however in x-plorer this namespace generates the same error.

thanks,
Denisse

Hi,

You do not need to use a namespace prefix for the current-date function. This means a quik workaround is just to drop the namespace prefix from the function call. Furthermore in Tamino 4.4 you do not need to declare the XML schema namespace prefix “xs”. You can use the prefix without declaring it.

Best Regards,

Thorsten Fiebig

Sorry, but I for got tell you :

I tested without namespace prefix for the current-date function, however this generates error too:

xquery:

{date(current-date())}

ERROR:
INOXQE6358: Function unknown Function: current-date; line 5, column 48: <![CDATA[current-date())} ]]>
The analyzed query:
{?explain?}

{date(current-date())}

Help me please!!

Thanks in advance,


Denisse Ca

Hi,

Which Tamino version do you use? The current-date() function is only supported by Tamino 4.4. To run your query against Tamino 4.4 you should restate it in the following way:

{xs:date(current-date())}

Since current-date() already delivers an xs:date instance, you can drop the xs:date constructor function. This means you can state your query like this:

{current-date()}

Best regards,

Thorsten Fiebig

Hi!!!,

I’am used Tamino 4.4, but the Database is 4.2!!!.. I tried to migrate the scheme through “Software AG Tamino 4.4 Scheme Editor”, but I could not. The following error was generated:

" datatype validation for element ‘tsd:which’ of type xs:string failed: (cvc-pattern-valid) Facet ‘pattern’ was violated by a value during validation <INOXDE7703,INOXDE7772>"

the schemes are not compatible?

Thanks in advance,


Denisse Ca

use “set version” to bing teh database to 4.4.
It is possible that during this version upgrade, errors concerning non-valid schemas are reported. This is because 4.2. had allowed some schema variants that are not valid according to teh schema spec. If you encounter such a situation, you can use teh schema editor as you describe. It will report the place where the schema violates teh schema spec.
In your case, howver, it seems that the error is in a “tds:which” element. If you cannot find out teh cause by yourself, please post this schema part (the tsd:which element)

HI!!!

I solved my problem:

I set the version of the existing version 4.2 database to version 4.4 by using the SET VERSION command on the database in the Tamino Manager.

Now xquery with current-date() is executed without problems.

Thank you very much to help me!!!

Denisse.

Hi

great that your query works now! Nevertheless you should check the job log from SET VERSION or issue the following command in order to detect schema incompatibilities as mentioned by Harald Schoening:

_admin=ino:CheckSchema( [ collection, [schema] ])

Probably, the same message as before should show up. In order to avoid future problems, you should fix that. In case of doubt, you may provide your schema as an attachment.

Regards
Uli