[xquery-talk] Problems with query on different doccument

Jonathan Robie jonathan.robie at datadirect.com
Thu Nov 30 11:24:24 PST 2006


The problem is in this line:

doc("casodistudio.xml")//string($name)/code

On the left side of the slash you have a string, and you are trying to 
find element children of that string. I think you are actually looking 
for some element that contains an attribute with that value. Perhaps you 
are looking for an appinfo containing a code element with an attribute 
that matches the string? Then you might use something like this:

doc("casodistudio.xml")//xs:appinfo[code/@key=$name]

Jonathan

Giulio Rizzo wrote:
> Hi
>
> I have a problem, I have to query the schema to take
> some data and than use it in another query on a
> document XML instance of the schema. I tried something
> like this:
>
> xquery version "1.0";
> for $name in doc("casodistudio.xsd")//xs:element
> [xs:annotation/xs:appinfo/type = 'entity']/@name
> for $pr in 
> doc("casodistudio.xml")//string($name)/code
> return <code pr="{$pr}"/>
>
> What I'm trying here is to get all the name of the
> entity from the schema (contained in the attribute
> name of some xs:element, the one with the specified
> appinfo). With this name I want to query the instance
> to get all the attribute code (the key of the entity).
> The results is an empty query, maybe i missunderstood
> the use of the function "string".
> I espect the query to works like: if the value in the
> attribute is, i.e., ASL, the query string(name)/code
> must be equivalent to ASL/code.
> Thanks to everibody for the attention and sorry for my
> bad english.
>
> Giulio
>
>
> __________________________________________________
> Do You Yahoo!?
> Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi 
> http://mail.yahoo.it 
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
>   


-- 
Read my Blog: http://blogs.datadirect.com/jonathan_robie/
Learn XQuery: http://media.datadirect.com/download/docs/ddxquery/tutorial_query.html
Learn XQJ (the JDBC for XQuery): http://www.datadirect.com/developer/xquery/topics/xqj_tutorial/
Get DataDirect XQuery: http://www.datadirect.com/products/xquery/



More information about the talk mailing list