failure to parse eXist function in xquery

Issues related to W3C XQuery.
Lurker
Posts: 2
Joined: Mon Aug 13, 2012 7:13 pm

failure to parse eXist function in xquery

Post by Lurker »

The error I get from oxygen is:
F [Saxon-PE XQuery 9.4.0.3] Cannot find a matching 3-argument function named {http://exist-db.org/xquery/transform}transform()
The same query works as expected when pasted into the eXist sandbox, or run by a perl XMLRPC tool using the same query file as specified for the oxygen editor.

I'm having trouble understanding what the problem might be with the saxon parser(s)(I've tried all three).

I'm using oxygen 14 and eXist 1.4.2.

My query is shown at the bottom, below. The line flagged as the error is the one that goes
... <any/>,
The eXist funciton signatures are here: http://exist-db.org/exist/functions/transform/transform

I use the same exist.jar file in the oxygen data source tool as I use on the eXist server.

Code: Select all

declare namespace local     = "http://www.local.com";
declare namespace xsl = "http://www.w3.org/1999/XSL/Transform";
declare namespace transform = "http://exist-db.org/xquery/transform";

declare function local:total-hours-from-duration
( $duration as xs:dayTimeDuration? ) as xs:decimal? {
$duration div xs:dayTimeDuration('PT1H')
} ;

declare function local:format-number($n as xs:decimal ,$s as xs:string) as xs:string {
string(transform:transform(
<any/>,
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match='/'>
<xsl:value-of select="format-number({$n},'{$s}')"/>
</xsl:template>
</xsl:stylesheet>,
()
))
};

let $cd := xs:dateTime(fn:current-date())

for $ss in
collection('/db/homer/2012/07')//sampleSet/site[@name='LCO']

let $sdt := dateTime(xs:date($ss/../../@sampleDate),xs:time($ss/../@time))
let $dif := local:format-number(local:total-hours-from-duration($cd - $sdt), "#,###0.00#" )

order by $dif descending

return
<Record>
<When>{$sdt}</When>
<Ago>{$dif}</Ago>
{for $r in distinct-values($ss//Description/race)
let $N := count($ss//Description[race=$r])
order by $r descending
return <line>{$r} :: {$N} </line>}
</Record>
ionela
Posts: 400
Joined: Mon Dec 05, 2011 6:08 pm

Re: failure to parse eXist function in xquery

Post by ionela »

Hello,

Note that transform:transform function from your XQuery file is an eXist function and Saxon engine does not recognize eXist functions.

To execute the eXist XQuery in oXygen you should use the eXist connection as the XQuery processor. To do this, you need to configure a transformation scenario (Document -> Transformation-> Configure Transformation Scenario) and choose the eXist connection in the "Transformer" combo box.

Regards,
Ionela
Ionela Istodor
oXygen XML Editor and Author Support
Lurker
Posts: 2
Joined: Mon Aug 13, 2012 7:13 pm

Re: failure to parse eXist function in xquery

Post by Lurker »

Thanks, I'll give that a try.
Post Reply