File: XMark-Q10.xq

package info (click to toggle)
qtxmlpatterns-opensource-src 5.15.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 309,144 kB
  • sloc: xml: 360,343; cpp: 91,994; ansic: 388; sh: 53; sed: 31; makefile: 23
file content (40 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (4)
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
(: Written By: Frans Englich(maintainer, not original author) :)
(: Purpose: List all persons according to their interest;
            use French markup in the result. :)
(: Date: 2007-03-09 :)
(: insert-start :)
declare variable $input-context external;
(: insert-end :)

<XMark-result-Q10>
  {
  let $auction := $input-context
  return
    for $i in
      distinct-values($auction/site/people/person/profile/interest/@category)
    let $p :=
      for $t in $auction/site/people/person
      where $t/profile/interest/@category = $i
      return
        <personne>
          <statistiques>
            <sexe>{$t/profile/gender/text()}</sexe>
            <age>{$t/profile/age/text()}</age>
            <education>{$t/profile/education/text()}</education>
            <revenu>{fn:data($t/profile/@income)}</revenu>
          </statistiques>
          <coordonnees>
            <nom>{$t/name/text()}</nom>
            <rue>{$t/address/street/text()}</rue>
            <ville>{$t/address/city/text()}</ville>
            <pays>{$t/address/country/text()}</pays>
            <reseau>
              <courrier>{$t/emailaddress/text()}</courrier>
              <pagePerso>{$t/homepage/text()}</pagePerso>
            </reseau>
          </coordonnees>
          <cartePaiement>{$t/creditcard/text()}</cartePaiement>
        </personne>
    return <categorie>{<id>{$i}</id>, $p}</categorie>
  }
</XMark-result-Q10>