Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cts:uris()[matches(., '^[^/]*/$')]
- declare variable $start external := 1 ;
- declare variable $end external := 1000;
- declare variable $urimatch external := "" ;
- fn:distinct-values(
- for $d in cts:uris("","any" )
- where ($urimatch eq "" or contains( $d , $urimatch ) )
- return
- if( matches( $d , "^[a-zA-Z]+://" ) ) then
- replace( $d , "(^[a-zA-Z]+://[a-zA-Z0-9_.-]+/).*","$1" )
- else
- if( contains( $d , "/" ) ) then
- substring-before( $d , "/" ) || "/"
- else
- $d
- )[ $start to $end ]
- let $dir := (
- let $current := map:map()
- let $_ := map:put($current, "element", "")
- for $uri in cts:uris()
- let $toks := fn:tokenize($uri, "/")
- let $element := if (map:get($current, "element") ne $toks[2]) then element directory { $toks[2] } else ()
- let $_ := map:put($current, "element", $toks[2])
- return if ($element/text() ne "") then $element else ()
- )
- let $doc := document { element root { $dir } }
- return $doc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement