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

Member Avatar for FakeTales

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

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 :-)

Member Avatar for FakeTales

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>

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

Member Avatar for FakeTales

if you face another problem PM me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.