[XML/XSL] Xquery Anzahl Problem

Dieses Thema im Forum "Webentwicklung" wurde erstellt von Dr. Cox, 9. Mai 2011 .

Schlagworte:
Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. 9. Mai 2011
    Xquery Anzahl Problem

    Hey, hab ein Problem mit einer Xquery Aufgabe und komme nicht auf das gewünschte Ergebnis.

    Die XML:
    Spoiler
    HTML:
    <?xml version="1.0"?>
    <publications>
     <publication type="inproceedings" provider="KA">
     <author>
     <person>Tina Mustermann</person>
     </author>
     <editor>
     <person>Armin Smith</person>
     <person>Rainer Mann</person>
     </editor>
     <title>Erfolgreiches IT</title>
     <year>2005</year>
     <volume>P-67</volume>
     <pages>1-12</pages>
     <booktitle>INFORMATIK</booktitle>
     <publisher>KA Verlag</publisher>
     <isbn>3-82157-123-4</isbn>
     </publication>
     <publication type="inproceedings" provider="KA">
     <author>
     <person>Walter Brau</person>
     <person>Martin Sneider</person>
     </author>
     <editor>
     <person>Armin Smith</person>
     <person>Rainer Mann</person>
     </editor>
     <title>Autonome Geschaeftsprozesse</title>
     <year>2005</year>
     <volume>P-67</volume>
     <pages>13-20</pages>
     <booktitle>INFORMATIK</booktitle>
     <publisher>KA Verlag</publisher>
     <isbn>3-12345-396-2</isbn>
     </publication>
     <publication type="proceeding" provider="KA">
     <author>
     <person>Tina Mustermann</person>
     </author>
     <editor>
     <person>Tim Johansson</person>
     <person>Don Alan</person>
     </editor>
     <title>Semantic Web Services</title>
     <year>2005</year>
     <volume>A-5</volume>
     <pages>3-18</pages>
     <booktitle>Informationswissenschaft</booktitle>
     <publisher>KA Verlag</publisher>
     <isbn>3-74512-396-2</isbn>
     </publication>
    </publications>
    

    Die Aufgabe:
    Mein Ansatz:
    HTML:
    let $doc := doc("C:\Users\Lumpi\Documents\Uni-Kram\Informationssysteme\xquery\publications.xml")
    for $ppl in distinct-values($doc/publications/publication/author/person)
    let $count := count($doc/publications/publication/author[person = $ppl])
    let $max := max($count)
    return $max
    Und dabei hackt es sogar schon, ich kann nicht einmal das Maximum bestimmen.
    Wo liegt mein Fehler?
     
  2. 10. Mai 2011
    AW: Xquery Anzahl Problem

    Glaub in so einem Fall ist ein Doppelpost erlaubt... habe eine Lösung für meine Problemstellung:
    Code:
    let $doc := doc("C:\Users\Lumpi\Documents\Uni-Kram\Informationssysteme\xquery\publications.xml")
    let $auth := (
    for $p in distinct-values($doc/publications/publication/author/person)
    let $count := count($doc/publications/publication/author[person = $p])
    return <Author><Name>{$p}</Name><Anzahl>{$count}</Anzahl></Author>
    )
    for $au in $auth
    return if($au/Anzahl = max($auth/Anzahl))
    then $au/Name/text()
    else ()
     
  3. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.