[xquery-talk] function definitions

Dmitri.Colebatch at toyota.com.au Dmitri.Colebatch at toyota.com.au
Fri Aug 1 12:10:02 PDT 2003


hey all,

another question.... hopefully not quite as trivial as the last.

I'm trying to define my own function, and have the following in my header,
however I am getting parse exceptions from the bea weblogic implementation.
Can someone tell me if this is a problem with my code or their
implementation...

define function convertSAPDateTime($dateNode as node(), $timeNode as
node())
      as xs:dateTime
{
      let $dateStr := data($dateNode)
      let $yyyy := xf:substring($dateStr, 1, 4)
      let $mm := xf:substring($dateStr, 5, 2)
      let $dd := xf:substring($dateStr,7, 2)

      let $timeStr := data($timeNode)
      let $HH := xf:substring($timeStr, 1, 2)
      let $mi := xf:substring($timeStr, 3, 2)
      let $ss := xf:substring($timeStr, 5, 2)

      return xf:dateTime(xf:concat($yyyy, '-', $mm, '-', $dd, 'T', $HH,
':', $mi, ':', $ss))
}

the code inside the braces works fine when not defined as part of a
function, but I am getting parse exceptions on the "as" in "$dateNode as
node()".  If I remove the "as node()" then it works fine, however I then
have the wrong type for the data function... I assume could cast it, but as
I understand it the above should work...

fwiw I'm using http://www.w3.org/TR/xquery/#FunctionDefns as my reference.

thanks again for your help.

cheers
dim






- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                               DISCLAIMER
* This email and any attachment may contain confidential information.
  If you are not the intended recipient you are not authorised to copy
  or disclose all or any part of it without the prior written consent
  of Toyota.
* Opinions expressed in this email and any attachment are those of the
  sender and not necessarily the opinions of Toyota.
* Please scan this email and any attachment for viruses.  Toyota does
  not accept any responsibility for problems caused by viruses, whether
  it is Toyota's fault or not.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




More information about the talk mailing list