-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanf_deu.qry
49 lines (38 loc) · 1.74 KB
/
anf_deu.qry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(: Copyright 2022 vbprofi. :)
(: GNU GENERAL PUBLIC LICENSE :)
(: Version 3, 29 June 2007 :)
(:------------------ QUERY PROLOG ------------------:)
(:------------------ NAMESPACES ------------------:)
declare default element namespace "http://www.w3.org/1999/xhtml";
(:------------------ IMPORTS ------------------:)
import module namespace fsi = "http://freedomscientific.com/ResearchItImports" at "ResearchItLibrary.jri";
(:------------------ FUNCTIONS ------------------:)
declare function local:make-link ($link as xs:string, $title as xs:string) as xs:string*
{
('<a href="', replace($link,",","%2c"), '" target="_blank">',
$title, '</a>', $fsi:new_line)
};
declare function local:process-each ($list as node()*) as xs:string*
{
for $item at $count in $list
let $link := local:make-link (data ($item/*[name()='link']), data ($item/*[name()='title']))
let $desc := fsi:output-clean-lines ($item/*[name()='description'])
let $content := fsi:output-clean-lines ($item/*[name()='content'])
return ($link, $desc, $content, $fsi:new_line)
};
declare function local:main ()
{
if (count ($stories)) then
('Es werden jetzt nachfolgend die aktuellen Nachrichten aufgelistet.', $fsi:new_line, $fsi:new_line,
local:process-each ($stories))
else (
"Es konnten keine aktuellen Nachrichten heruntergeladen werden. Vergewissern Sie sich, dass eine Internet-Verbindung besteht.",
$fsi:new_line
)
};
(:------------------ VARIABLES ------------------:)
declare variable $URL := "http://anfdeutsch.com/feed.rss";
declare variable $doc := doc ($URL);
declare variable $stories := $doc/*[name()='rss']/*[name()='channel']/*[name()='item'];
(:------------------ QUERY BODY ------------------:)
local:main ()