relpipe-data/examples/atom.xq
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 01:21:22 +0100
branchv_0
changeset 330 70e7eb578cfa
parent 232 c7d05cf04b76
permissions -rw-r--r--
Added tag relpipe-v0.18 for changeset 5bc2bb8b7946
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
232
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
xquery version "1.0";
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
declare namespace relpipe="tag:globalcode.info,2018:relpipe";
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
declare namespace atom="http://www.w3.org/2005/Atom";
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
<relpipe xmlns="tag:globalcode.info,2018:relpipe">
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
	<relation>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
		<name>atom</name>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
		<attributes-metadata>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
			<attribute-metadata name="published" type="string"/>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
			<attribute-metadata name="title" type="string"/>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
			<attribute-metadata name="url" type="string"/>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
		</attributes-metadata>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
		{
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
			for $e in /atom:feed/atom:entry
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
			order by $e/atom:published descending
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
			return
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
				<record>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
					<attribute>{$e/atom:published/text()}</attribute>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
					<attribute>{$e/atom:title/text()}</attribute>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
					<attribute>{string($e/atom:link/@href)}</attribute>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
				</record>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
		}
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
	</relation>
c7d05cf04b76 examples: Read an Atom feed using XQuery and relpipe-in-xml
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
</relpipe>