From: Loren C. <lor...@gm...> - 2014-03-23 20:32:17
|
Hello folks. I found what appears to be a bug in the at expression in a flwor statement. (current codebase) I have the following in a function module: declare function xs2svg:recurse($node as node()?, $model as map()) as item()* { if ($node) then let $children := $node/node() let $count := map:entry('count', count($children)) let $parent-y := map:entry('parent-y', $model('y-position')) let $parent-x := map:entry('parent-x', $model('x-position')) let $x-position := map:entry('x-position', xs:integer($model('x-position')) + xs:integer($model('width')) + 45) let $id := $model('id') return for $cnode at $position in $children let $new-id := xs:string($id) || '_' || xs:string($position) let $new-map := map:new(( map:entry('id', $new-id ), map:entry('y-position', xs:integer($model('y-position')) + (($position - 1) * (46 + 25))), $x-position, $parent-x, $parent-y, $count, map:entry('position', $position) )) order by $position return xs2svg:process-node($cnode, $new-map) else () }; I get the following values 10, 12, 14, 15, ... instead of 1, 2, 3, 4, ... When I run the following in eXide, it does give the proper values: xquery version "3.0"; let $doc := doc('http://www.docbook.org/xml/5.0/xsd/docbook.xsd')//xs:schema let $children := $doc/node() let $results := for $cnode at $position in $children return <result name='{$cnode/@name}' position='{$position}'></result> return <results>{$results}</results> I am attaching the XAR. Run the code in modules/runsvg.xq I am in the process of translating the code for http://xsdvi.sourceforge.net/ipo.svg from java to an XQuery function module. |