|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Printing Siblings in FunctionsWei, Alice J. ajwei at indiana.eduSun Mar 2 14:03:29 PST 2008
Hi, I have an XQuery as follows: declare variable $data := <ad> <head type ="main">High School <lb/> Diploma & Ring</head> <head type ="sub">YOURS Through Home Study</head> <description> <p>Prepare for GED or College Entrance <address> <addressLine>400 N. Interurban Richardson,</addressLine> <addressLine>Texas 75080</addressLine> </address> </p> <p> <emph rend ="bold">Texts Purchased by: Departments of Education·Private Schools·Colleges</emph> Mail this Coupon NOW. For Persons 18 or Over <address> <addressLine>United Schools and Services Dept. M676</addressLine> <addressLine>Box 1068, Richardson, Texas 75080</addressLine> </address> </p> <p>Please rush FREE information about High School</p> </description> </ad>; declare variable $s := $data/head[contains(upper-case(.), 'SCHOOL')]; declare function local:unique-nodes-by-value($seq as element()*) as element()* { for $d in distinct-values($seq) let $head := $seq/parent::ad/descendant::head return <ad>{$head[. = $d][1]}</ad> }; local:unique-nodes-by-value($s) What I want to do is to extract the entire <head> node and have it ordered by the "content within the first position of the head node," However, when I run the script, this is what it gives me: <?xml version="1.0" encoding="UTF-8"?> <ad> <head type="main">High School <lb/> Diploma & Ring</head> </ad> My intended output is as follows: <ad> <head type ="main">High School <lb/> Diploma & Ring</head> <head type ="sub">YOURS Through Home Study</head> </ad> Have I done something wrong? Any suggestion is appreciated. Alice ====================================================== Alice Wei MIS 2008 School of Library and Information Science Indiana University Bloomington http://x-query.com/mailman/listinfo/talk
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






