[xquery-talk] flwor expression result

e-letter inpost at gmail.com
Thu Dec 19 10:24:10 PST 2013


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?



More information about the talk mailing list