Xquery 3.0
for $x in doc("XMLexemplo.xml")/Calendario/Curso/UC/Unidade/Exames/Exame
let $day := fn:day-from-date(xs:date($x/Dia))
where $day>=20 and $day <=21
return count($day)
The output is 1 1but i expect 2.
Xquery 3.0
for $x in doc("XMLexemplo.xml")/Calendario/Curso/UC/Unidade/Exames/Exame
let $day := fn:day-from-date(xs:date($x/Dia))
where $day>=20 and $day <=21
return count($day)
The output is 1 1but i expect 2.
You are asking for a count for each day, which is necessarily 1. What you want is to count the size of the whole result, so wrap the count around the whole FLWOR expression:
count(
for $x in doc("XMLexemplo.xml")/Calendario/Curso/UC/Unidade/Exames/Exame
let $day := fn:day-from-date(xs:date($x/Dia))
where $day>=20 and $day <=21
return $day
)