Loading rxq/html.xqm +36 Changes for rxq/html.xqm: 36 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,9 @@ import module namespace max.util = 'pddn/max/util' at 'util.xqm'; import module namespace max.i18n = 'pddn/max/i18n' at 'i18n.xqm'; import module namespace max.toc = 'pddn/max/toc' at 'toc.xqm'; import module namespace request = "http://exquery.org/ns/request"; (: : Wraps div in HTML simple template. : @param $wrapped element to wrap in html Loading Loading @@ -397,7 +400,40 @@ declare function max.html:renderTemplate($htmlDoc as document-node(), $map as ma return "declare variable $" || $var || " external;") return xquery:eval($declarations || serialize($htmlDoc), $map) }; declare function max.html:getSitemap($project){ let $baseUri := replace(request:uri(), concat($project, '/sitemap.xml'), '') return <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> { (: pages éditoriales :) for $entry in doc("../editions/" || $project || "/" || $max.cons:MENU_FILE)//*:entry[@type="main"] return <url> <loc>{$baseUri}{$project}/{string($entry/*:target)}</loc> </url> } { (: fragment xml :) let $docs := db:list( max.config:getProjectDBPath($project) ) for $doc in $docs let $toc := max.toc:getDocumentTOC($project, $doc) let $urls := $toc//*:ul[@id="routeEntries"]/*:li/*:a for $url in $urls let $url := substring($url/@href, 2) return <url> <loc>{$baseUri}{$url}</loc> </url> } </urlset> }; Loading Loading
rxq/html.xqm +36 Changes for rxq/html.xqm: 36 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,9 @@ import module namespace max.util = 'pddn/max/util' at 'util.xqm'; import module namespace max.i18n = 'pddn/max/i18n' at 'i18n.xqm'; import module namespace max.toc = 'pddn/max/toc' at 'toc.xqm'; import module namespace request = "http://exquery.org/ns/request"; (: : Wraps div in HTML simple template. : @param $wrapped element to wrap in html Loading Loading @@ -397,7 +400,40 @@ declare function max.html:renderTemplate($htmlDoc as document-node(), $map as ma return "declare variable $" || $var || " external;") return xquery:eval($declarations || serialize($htmlDoc), $map) }; declare function max.html:getSitemap($project){ let $baseUri := replace(request:uri(), concat($project, '/sitemap.xml'), '') return <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> { (: pages éditoriales :) for $entry in doc("../editions/" || $project || "/" || $max.cons:MENU_FILE)//*:entry[@type="main"] return <url> <loc>{$baseUri}{$project}/{string($entry/*:target)}</loc> </url> } { (: fragment xml :) let $docs := db:list( max.config:getProjectDBPath($project) ) for $doc in $docs let $toc := max.toc:getDocumentTOC($project, $doc) let $urls := $toc//*:ul[@id="routeEntries"]/*:li/*:a for $url in $urls let $url := substring($url/@href, 2) return <url> <loc>{$baseUri}{$url}</loc> </url> } </urlset> }; Loading