Changeset 732 for MDRepository


Ignore:
Timestamp:
09/29/10 13:56:25 (14 years ago)
Author:
ljo
Message:

cmd-model.xqm - Correct collections passing in elem-r().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDRepository/trunk/xquery/cmd-model.xqm

    r729 r732  
    4949      util:eval(fn:concat("$collection//", $path))
    5050    else
    51       for $coll in $collections return util:eval(fn:concat("$collection//ft:query(descendant::IsPartOf, <query><term>", xdb:decode($coll) ,"</term></query>)//", $path, "/ancestor::CMD"))
    52 
    53   let $path-count := count($path-nodes)
     51      for $coll in $collections
     52      return
     53        util:eval(fn:concat("$collection//ft:query(descendant::IsPartOf, <query><term>", xdb:decode($coll), "</term></query>)//", $path, "/ancestor::CMD"))
     54
     55      let $path-count := count($path-nodes)
    5456   
    55   let $subs := distinct-values($path-nodes/child::element()/name())
    56   let $text-nodes := $path-nodes//text()
    57   let $text-count := count($text-nodes)
    58   let $text-count-distinct := count(distinct-values($text-nodes))
    59   return
     57      let $subs := distinct-values($path-nodes/child::element()/name())
     58      let $text-nodes := $path-nodes//text()
     59      let $text-count := count($text-nodes)
     60      let $text-count-distinct := count(distinct-values($text-nodes))
     61      return
    6062        <Term path="{fn:concat("//", $path)}" name="{text:groups($path, "/([^/]+)$")[last()]}" count="{$path-count}" count_text="{$text-count}"  count_distinct_text="{$text-count-distinct}">{
    6163          if ($depth > 0) then
    6264            (for $elname in $subs[. != '']
    6365            return
    64               cmd-model:elem-r($collection, concat($path, '/', $elname), $max-depth, $depth - 1),
     66              cmd-model:elem-r($collections, concat($path, '/', $elname), $max-depth, $depth - 1),
    6567              if ($max-depth eq 1) then cmd-model:values($path-nodes) else ())
    6668          else 'maxdepth'
Note: See TracChangeset for help on using the changeset viewer.