1 declare namespace my="my.uri"; 2 declare function my:section-summary($book-or-section as element()) 3 as element()* 4 { 5 (: XQuery code inside {} :) 6 for $section in $book-or-section/section 7 return 8 (: XML inside XQuery code :) 9 <section> 10 { $section/title } 11 <figcount> 12 { count($section/figure) } 13 </figcount> 14 { my:section-summary($section) } 15 </section> 16 }; 17 18 (: XQuery comment :) 19 let $ggg := 123 20 return 21 <toc> 22 <!-- XML comment--> 23 { 24 let $uuuuu := ( $ggg , $ggg) 25 let $ggg := 123 26 for $s in doc("book.xml")/book 27 return ( 28 my:section-summary($s) , 29 <my-tag/> 30 ) 31 (: list definition :) 32 } 33 </toc>