Help with X-Query...

Hi,

When I do a http:///tamino/database/chunks?_xquery=for $p in input() return $p

I get this

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2” xmlns:xql=“XQL FAQ (XML Query Language - Frequently Asked Questions)”>
- <xq:query xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
- <![CDATA[ for $p in input() return $p
]]>
</xq:query>
- <ino:message ino:returnvalue=“0”>
ino:messagelineXQuery Request processing</ino:messageline>
</ino:message>
- <xq:result xmlns:xq=“http://namespaces.softwareag.com/tamino/XQuery/result”>
- xq:object
-
-
-
i1001
g1001
Text…
chapter

nl
false

-
-
1.0.0
2005-01-12


-



Now I’d like to have a query that gives me chunk/* where chunk/meta/identification/id = i1001

So I tested: http:///tamino/database/chunks?_xquery=for $p in input() where input()/chunk/meta/id=i1001 return $p/chunk/*

Which gives me a <ino:messagetext ino:code=“INOXQE6360”>Unbound path not allowed here</ino:messagetext>
ino:messagelineLine 1, column 62: </ino:messageline>

What am I doing wrong?

Michel

Something like this should work:
for $p in input()/chunk where
$p/meta/identification/id=“i1001”
return $p
HTH

It doesn’t… sorry…

Even if I leave out the where-clause it doesn’t return a thing… Any clue?

Michel

Could you please post your schema and an xml instance so I can try it.
Thanks

Hi Michel and thanks for the information. Your document is in a custom namespace, so the correct form of your XQuery request is:

declare namespace pre="http://www.nibra.nl/bzk" 
for $p in input()/pre:chunk 
where 
$p/pre:meta/pre:identification/pre:id="0000" 
return $p


Your original query worked because it simply asked for everything in collection “chunks”. As soon as you ask specifically for a doctype, your request has to be namespace-correct.
HTH

Thank! wouldn’t have thought of that…