0

Hi,

I am having a problem regarding the return statment, for some reason it is not working, can someone please tell me what i am doing wrong? The return is taking a selection of table collumns not all e.g. the simple return all "return $x"

Thanks

for $x in doc("Suppliers.xml")/dataroot/Suppliers[Country != "France"]
return $x/SupplierID $x/CompanyName $x/ContactName $x/ContactTitle $x/Address $x/City $x/Country

Edited by ROSS679

2
Contributors
5
Replies
23
Views
3 Years
Discussion Span
Last Post by FakeTales
0

guessing your using the XML file generated from the MS Access Northwind Databse, Also guessing your using Saxon to run the Queries. Any chance from Uni of Glamorgan?

anyway this works

xquery version "1.0";

<dataroot>
{
for $x in doc("../xmlFiles/Suppliers.xml")/dataroot/Suppliers[Country != "France"]
return
<Suppliers>
{$x/SupplierID}
{$x/CompanyName}
{$x/ContactName}
{$x/ContactTitle}
{$x/Address}
{$x/City}
{$x/Country}
</Suppliers>
}
</dataroot>

the ../XmlFiles bit is to gain access to the folder Called XmlFiles where the Suppliers.xml file is located

0

Hi,

Yes i am from Uni Glamorgan and thanks for your answer much aprreicated, im running the queries in Stylus Studio, i found it much easier than using Saxon/XML Spy. Good Luck with your assignment :-)

0

Thought you was, if you want to return everything then just do, running all my queries from a batch file saxon is okay however need the EE edition if i want to insert, update, delete etc etc

<Suppliers>
{$x}
</Suppliers>
0

Thanks for your help FakeTales and good luck for your exams.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.