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

Problems with query on different doccument

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


  Problems with query on different doccument
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 
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> 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/



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.