Page 1 of 1

how would i configure the editor so that saxon can find file

Posted: Wed Jan 31, 2007 1:06 am
by joyceschan
I was looking at this tutorial

http://www.xml.com/pub/a/2005/03/02/xquery.html

which I think makes use of the xquery collection function, and I'm getting 'invalid URI passed to {recipeml/docs.xml} passed to collection() function' error

I've check that the example runs with saxon using command line.

Pls help
:-)

Posted: Wed Jan 31, 2007 11:24 am
by sorin_ristache
Hello,

I do not get the error. Please post small samples of your XQuery file, your collection catalog file and the XML documents referred in the collection catalog file.


Regards,
Sorin

Posted: Wed Jan 31, 2007 5:23 pm
by joyceschan
my xquery file:
----------------------------
(: A unique, sorted list of all unique
ingredients in the recipe collection,
with URLS to link to the recipes. :)

<ingredients>
{
for $ingr in
distinct-values(collection('recipeml/docs.xml')/recipeml/recipe/ingredients/ing/item)
order by $ingr
return
<item name="{$ingr}">
{
for $doc in
collection('recipeml/docs.xml')
where $doc/recipeml/recipe/
ingredients/ing/item = $ingr

return
<title url="{document-uri($doc)}">
{$doc/recipeml/recipe/head/title/text()}
</title>
}
</item>
}
</ingredients>

============================================

docs.xml file looks like:
--------------------------------
<collection>
<doc href="1-2-3_Cookies.xml"/>
<doc href="1001_Cookiemix.xml"/>
<!-- more doc elements... -->
<doc href="Beef_Andy_Warhol.xml"/>
<doc href="Beauty_Spa_Express.xml"/>
<doc href="$250.00_Cookies_(Neiman_Marcus).xml"/>
<doc href="1-2-3-4_Cake_with_Caramel_Icing.xml"/>
</collection>
============================================


recipe file looks like:
--------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
<recipe>
<head>
<title>Beef and Cheese Pie</title>
<categories>
<cat>Pies</cat></categories>
<yield>8</yield></head>
<ingredients>
<ing>
<amt>
<qty>1 1/4</qty>
<unit>pounds</unit></amt>
<item>Ground beef</item></ing>
<ing>
<amt>
<qty>1/3</qty>
<unit>tablespoons</unit></amt>
<item>Cinnamon</item></ing>
<ing>
<amt>
<qty>1/4</qty>
<unit/></amt>
<item>Chopped green bell pepper</item></ing>
<ing>
<amt>
<qty>1</qty>
<unit>can</unit></amt>
<item>8 oz. tomato sauce and mushr</item></ing>
<ing>
<amt>
<qty>1</qty>
<unit>can</unit></amt>
<item>8 oz. cut green beans</item></ing>
<ing>
<amt>
<qty>1/4</qty>
<unit>teaspoons</unit></amt>
<item>Garlic salt</item></ing>
<ing>
<amt>
<qty>1</qty>
<unit>can</unit></amt>
<item>8 oz. crescent rolls</item></ing>
<ing>
<amt>
<qty>1</qty>
<unit/></amt>
<item>Egg,slightly beaten</item></ing>
<ing>
<amt>
<qty>2</qty>
<unit>cups</unit></amt>
<item>Shredded Cheddar cheese</item></ing></ingredients>
<directions>
<step> Preheat oven to 375 degrees.Fry ground beef,onion and green bell pepper
in a large frying pan.Drain fat.Stir in tomato sauce, beans,and
seasoning.Simmer while preparing crust.Separate crescent rolls into 8
triangles.Place in an ungreased 9" pie pan.Press bottom and sides to form a
crust.Combine egg and 1 cup cheese. Spread over crust,evenly.Spoon hot meat
mixture into crust. Sprinkle with remaining cheese.Bake for 20 to 25
minutes.Serves 6.

From Gemini's MASSIVE MealMaster collection at http://www.synapse.com/~gemini

</step></directions></recipe></recipeml>

Posted: Thu Feb 01, 2007 4:36 pm
by sorin_ristache
Hello,

I created a docs.xml inside the recipeml subfolder of the folder containing the XQuery, with the content:

Code: Select all

<collection>
<doc href="1-2-3_Cookies.xml"/>
</collection>
I created the 1-2-3_Cookies.xml file in the same folder as docs.xml containing the "Beef and Cheese Pie" recipeml element that you posted, I executed the XQuery and I obtained:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ingredients>
<item name="8 oz. crescent rolls">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="8 oz. cut green beans">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="8 oz. tomato sauce and mushr">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="Chopped green bell pepper">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="Cinnamon">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="Egg,slightly beaten">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="Garlic salt">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="Ground beef">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
<item name="Shredded Cheddar cheese">
<title url="file:/D:/temp/support/ftopic2192/recipeml/1-2-3_Cookies.xml">Beef and Cheese Pie</title>
</item>
</ingredients>
If you still get the error when running the XQuery please send us an archive containing the folder with all the files that you use for running the XQuery.


Regards,
Sorin

Posted: Thu Feb 01, 2007 5:49 pm
by joyceschan
This is working now, thanks!