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

filling in an xquery

David Sinclair dsinclair at teleflex.com
Tue Sep 28 11:18:08 PDT 2004


writing xqueries syntax
Thanks to everyone who replied to my question.  I am using Tamino and 
just had a quick first trawl through their java API looking for a way to 
set variables.  I didnt see anything, but shall have a more detailed 
look when I have time. This approach sounds much better than what I have 
been doing, especially since all the substitutions currently done are 
simple strings.

David Sinclair.


Michael Kay wrote:

>If the only variables are simple strings or numbers then you can declare
>external variables (parameters) to the query and supply values for the
>parameters at run-time.
>
>You can also use this technique for some simple substitution of names in
>path expressions, using the syntax *[name()=$param].
>
>XSLT users with complex applications often use meta-stylesheets, which
>transform the stylesheet before executing it. This is one of the main
>benefits you get from using an XML syntax, and it can't really be done in
>the same way with XQuery - the XML syntax, XQueryX, is far too low-level to
>make this a realistic option.
>
>Another technique is to use an evaluate() extension function which
>constructs an (XPath/XQuery) expression on the fly from a string supplied at
>run-time. Saxon is one of the products that offers such an extension.
>
>Michael Kay
>http://www.saxonica.com/
> 
>
>  
>
>>-----Original Message-----
>>From: http://xquery.com/mailman/listinfo/talk 
>>[mailto:http://xquery.com/mailman/listinfo/talk] On Behalf Of David Sinclair
>>Sent: 27 September 2004 17:14
>>To: http://xquery.com/mailman/listinfo/talk
>>Subject:  filling in an xquery
>>
>>Hi,
>>
>>I have found myself writing xqueries that need parts to vary 
>>dynamically 
>>at runtime based on user input.    For example, I might want 
>>to use an 
>>xquery to drive a user defined search of a library for all the books 
>>containing a certain author, where the user types in this 
>>surname in a 
>>search field.
>>
>>The approach I have been taking is to write the xquery, and 
>>then where I 
>>want it to vary putting a JByte tag (see 
>>http://javaby.sourceforge.net/).  So something like this:
>>
>>    for $book in input()/books
>>    where $book/author/surname = {v:surname}
>>        .. format the output I want ...
>>
>>And then getting JByte to fill in the {v:surname} (and any other 
>>variable bits) for me.  This works,  but I think I would be more 
>>comfortable with it if the xquery syntax and the JByte syntax 
>>were not 
>>so easy to confuse.  This must be quite a common nut, and was just 
>>wondering if anyone had come up with a good way of cracking it?
>>
>>David Sinclair.
>>_______________________________________________
>>http://xquery.com/mailman/listinfo/talk
>>http://xquery.com/mailman/listinfo/talk
>>
>>    
>>
>
>_______________________________________________
>http://xquery.com/mailman/listinfo/talk
>http://xquery.com/mailman/listinfo/talk
>  
>


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.