[XQZone General] xdmp:eval question

Ian Small ian at marklogic.com
Tue Mar 15 09:38:53 PST 2005


Martin -

1) What is the whole query doing?  Three possible reasons for this
behaviour are (a) xdmp:eval() is returning a document node, so you might
need to say $result//beheerder, (b) you have a namespace conflict or (c)
xdmp:eval() is returning a binary or text node.

2) Is it really necessary to use xdmp:eval() or can you use a recursive
function within a single query to accomplish the same goal?

ian

-----Original Message-----
From: general-bounces at xqzone.marklogic.com
[mailto:general-bounces at xqzone.marklogic.com] On Behalf Of Folkerts,
Martin
Sent: Tuesday, March 15, 2005 4:36 AM
To: general at xqzone.marklogic.com
Subject: [XQZone General] xdmp:eval question

I have I query wich itself runs a query using xdmp:eval like:

  let $result := xdmp:eval( $query )
  return
    for $beheerder in $result/beheerder 
      return        
           show-beheerder($beheerder)

When i print $result it shows:
<rapportage items="5002 " xmlns="">
	      <beheerder name="MID" items="1173">
		<Afspraakuren items="180">
		  3
		</Afspraakuren><Afspraakuren items="319">
		  9
		</Afspraakuren><Afspraakuren items="460">
		  2
		</Afspraakuren>
	      </beheerder><beheerder name="ZUI" items="1059">
		<Afspraakuren items="150">
		  3
		</Afspraakuren><Afspraakuren items="280">
		  9
		</Afspraakuren><Afspraakuren items="459">
		  2
		</Afspraakuren>
	      </beheerder><beheerder name="NRD" items="1121">
		<Afspraakuren items="210">
		  9
		</Afspraakuren><Afspraakuren items="551">
		  2
		</Afspraakuren><Afspraakuren items="160">
		  3
		</Afspraakuren>
	      </beheerder>
	    </rapportage>

But when run in the for-loop it does not work ? That is, even though
there are multiple beheerders the count($result/beheerder) shows 0 !
When run standalone without using xdmp:eval it works. What am I doing
wrong ? 

Many thanks in advance
Martin Folkerts


_______________________________________________
General mailing list
General at xqzone.marklogic.com
http://xqzone.com/mailman/listinfo/general



More information about the General mailing list