我有以下代码:
<Table><ColumnHeaders>
<ColumnHeader name='Title' type='xs:string' />
<ColumnHeader name='EventDate' type='xs:date' />
<ColumnHeader name='today' type='xs:date' />
<ColumnHeader name='day-week' type='xs:integer' />
<ColumnHeader name='dur-end' type='xs:integer' />
<ColumnHeader name='start-date' type='xs:date' />
<ColumnHeader name='end-date' type='xs:date' />
</ColumnHeaders>
<Data>{let $today := fn:current-date()
let $day-week := functx:day-of-week($today)
let $dur-end := 6-$day-week
let $start-date := xs:date($today)-(xs:dayTimeDuration('P1D')*$day-week)
let $end-date := xs:date($today)+(xs:dayTimeDuration('P1D')*$dur-end)
for $ancestor0 in $queryresponse//*:row
where ($ancestor0/@ows_EventDate)>=$start-date
return<Row>
<Title>{fn:data($ancestor0/@ows_Title)}</Title>
<EventDate>{fn:data($ancestor0/@ows_EventDate)}</EventDate>
<today>{fn:data($today)}</today>
<day-week>{fn:data($day-week)}</day-week>
<dur-end>{fn:data($dur-end)}</dur-end>
<start-date>{fn:data($start-date)}</start-date>
<end-date>{fn:data($end-date)}</end-date>
</Row>}
</Data></Table>
在“for 语句”中添加 where 子句后,xquery 失败并出现以下错误:
ZorbaDynamicException 失败。Zorba 引擎遇到动态错误。错误类型:XQuery 引擎错误。传递的项目(UNTYPED_ATOMIC 类型)不可转换为传递的目标类型(xs:date)。
有人可以帮我解决这个问题吗?