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

paging mechanism

David Carlisle davidc at nag.co.uk
Fri Feb 3 11:44:47 PST 2006


message paging
  I tried this query:

  for $x at $pos in //text/body/idno
  for $y in $x/body/idno
  order by xs:decimal($x) ascending 
  return $y
  where ($pos mod 50) < 2
  return $x


at each iteration in the above $x is a single idno element
so $y is iterating over $x/body/idno which are idno grandchildren of
these idno elements (which is empty)

  'unexpected token "null" beyond end of query'
Not quite the message I would have expected, but your query ends at the
$y on line 4, you only have one FLWOR expression (which has two for
clauses) so it can only have one "return"


I was going to say what error message saxon gave here, but I see it
gives the "null" message. (Michael?)

If you delete the last two lines you get no error (but no result as $y
is iterating over an empty sequence)


I suggested 

(for $x   idno order by number($x) return $x)[position() mod 50 =1]
        ^
        in

But having seen the input form you probably want

(for $x in /col/text/body order by number($x/idno) return $x)[position() mod 50 =1]

$ saxon8q -s col.xml col.xq
<?xml version="1.0" encoding="UTF-8"?>
<body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                                <idno>001</idno>
                        </body>
<body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                                <idno>051</idno>
                        </body>
<body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                                <idno>101</idno>
                        </body>


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


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-2011 All Rights Reserved.