[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

using a context node in a for loop

Robert Koberg rob at koberg.com
Tue Oct 17 10:00:33 PDT 2006


  using a context node in a for loop
Hi, (more newbie questions)

Should the function below work? I want to define a node and use it to 
base the attributes off of. In the for loop (unlike the if..then 
statement), it seems I need the return statement, otherwise I get an 
error saying "unexpected token 'doc'". But, as written, I get an error 
"undefined context sequence for 'attribute::label'". I have also tried 
removing the parans grouping the li.

Also, notice in the for loop I am using a function to get the list to 
iterate through. Should that be a variable - or - does it only get 
evaluated once?

Here is the function:

declare function local:display-user-groups() as element()* {
   for $user-group in xmldb:get-user-groups($user)
     return
       doc(concat("projects/", $user-group, "/project.xml"))/*/
       (
         <li>
           <a href="#"
             onclick="submitForm('{@id}', '{@db-ref}')">
             {string(@label)}
           </a>
         </li>
       )
};

thanks,
-Rob



Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.