[xquery-talk] flwor expression result

Michael Kay mike at saxonica.com
Thu Dec 19 11:32:27 PST 2013


If you put an expression inside the content of an element node, it needs to go in curly braces. Otherwise it's just literal element content.

Michael Kay
Saxonica

On 19 Dec 2013, at 18:24, e-letter <inpost at gmail.com> wrote:

> Readers,
> 
> According to the xquery specification , the flwor expression (§ 3.8)
> syntax has optional parts, i.e. the 'let' part of the clause.
> Therefore the following expression was saved as an 'xq' file:
> 
> <html>
> <body>
> <ul>
> for $x in fn:doc("xmldatabasefile.xml")/bookstore/book/author
> 	order by $x/author
> 	return $x/author
> </ul>
> </body>
> </html>
> 
> This xquery file was processed using jedit xml plug-ins; xml file:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <!-- Edited by XMLSpy®, taken from http://www.w3schools.com-->
> <?xml-stylesheet type='text/xsl" href="xstylesheetexample.xslt" ?>
> <bookstore>
> 	<book
> 		category="COOKING">
> 		<title lang="en">Everyday Italian</title>
> 		<author>Giada De Laurentiis</author>
> 		<year>2005</year>
> 		<price>30.00</price>
> 	</book>
> ...
> 
> The output was:
> 
> <html>
>   <body>
>      <ul>
>         for $x in fn:doc("xmldatabasefile.xml")/bookstore/book/author
>         	order by $x/author
>         	return $x/author
> 
>      </ul>
>   </body>
> </html>
> 
> The expected output was a list of authors within the html un-ordered
> list element. What is my mistake please?
> 
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk




More information about the talk mailing list