summaryrefslogtreecommitdiffstats
path: root/examples/xmlpatterns/recipes/files
diff options
context:
space:
mode:
Diffstat (limited to 'examples/xmlpatterns/recipes/files')
-rw-r--r--examples/xmlpatterns/recipes/files/allRecipes.xq4
-rw-r--r--examples/xmlpatterns/recipes/files/cookbook.xml62
-rw-r--r--examples/xmlpatterns/recipes/files/liquidIngredientsInSoup.xq5
-rw-r--r--examples/xmlpatterns/recipes/files/mushroomSoup.xq5
-rw-r--r--examples/xmlpatterns/recipes/files/preparationLessThan30.xq9
-rw-r--r--examples/xmlpatterns/recipes/files/preparationTimes.xq5
6 files changed, 90 insertions, 0 deletions
diff --git a/examples/xmlpatterns/recipes/files/allRecipes.xq b/examples/xmlpatterns/recipes/files/allRecipes.xq
new file mode 100644
index 00000000..6888c310
--- /dev/null
+++ b/examples/xmlpatterns/recipes/files/allRecipes.xq
@@ -0,0 +1,4 @@
+(: Select all recipes. :)
+declare variable $inputDocument external;
+
+doc($inputDocument)/cookbook/recipe/<p>{string(title)}</p>
diff --git a/examples/xmlpatterns/recipes/files/cookbook.xml b/examples/xmlpatterns/recipes/files/cookbook.xml
new file mode 100644
index 00000000..3b6f621f
--- /dev/null
+++ b/examples/xmlpatterns/recipes/files/cookbook.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cookbook>
+ <recipe xml:id="MushroomSoup">
+ <title>Quick and Easy Mushroom Soup</title>
+ <ingredient name="Fresh mushrooms"
+ quantity="7"
+ unit="pieces"/>
+ <ingredient name="Garlic"
+ quantity="1"
+ unit="cloves"/>
+ <ingredient name="Olive oil"
+ quantity="2"
+ unit="tablespoons"/>
+ <ingredient name="Milk"
+ quantity="200"
+ unit="milliliters"/>
+ <ingredient name="Water"
+ quantity="200"
+ unit="milliliters"/>
+ <ingredient name="Cream"
+ quantity="100"
+ unit="milliliters"/>
+ <ingredient name="Vegetable soup cube"
+ quantity="1/2"
+ unit="cubes"/>
+ <ingredient name="Ground black pepper"
+ quantity="1/2"
+ unit="teaspoons"/>
+ <ingredient name="Dried parsley"
+ quantity="1"
+ unit="teaspoons"/>
+ <time quantity="20"
+ unit="minutes"/>
+ <method>
+ <step>1. Slice mushrooms and garlic.</step>
+ <step>2. Fry mushroom slices and garlic with olive oil.</step>
+ <step>3. Once mushrooms are cooked, add milk, cream water. Stir.</step>
+ <step>4. Add vegetable soup cube.</step>
+ <step>5. Reduce heat, add pepper and parsley.</step>
+ <step>6. Turn off the stove before the mixture boils.</step>
+ <step>7. Blend the mixture.</step>
+ </method>
+ </recipe>
+ <recipe xml:id="CheeseOnToast">
+ <title>Cheese on Toast</title>
+ <ingredient name="Bread"
+ quantity="2"
+ unit="slices"/>
+ <ingredient name="Cheese"
+ quantity="2"
+ unit="slices"/>
+ <time quantity="3"
+ unit="minutes"/>
+ <method>
+ <step>1. Slice the bread and cheese.</step>
+ <step>2. Grill one side of each slice of bread.</step>
+ <step>3. Turn over the bread and place a slice of cheese on each piece.</step>
+ <step>4. Grill until the cheese has started to melt.</step>
+ <step>5. Serve and enjoy!</step>
+ </method>
+ </recipe>
+</cookbook>
diff --git a/examples/xmlpatterns/recipes/files/liquidIngredientsInSoup.xq b/examples/xmlpatterns/recipes/files/liquidIngredientsInSoup.xq
new file mode 100644
index 00000000..3baecd8d
--- /dev/null
+++ b/examples/xmlpatterns/recipes/files/liquidIngredientsInSoup.xq
@@ -0,0 +1,5 @@
+(: All liquid ingredients form Mushroom Soup. :)
+declare variable $inputDocument external;
+
+doc($inputDocument)/cookbook/recipe[@xml:id = "MushroomSoup"]/ingredient[@unit = "milliliters"]/
+<p>{@name, @quantity, @unit}</p>
diff --git a/examples/xmlpatterns/recipes/files/mushroomSoup.xq b/examples/xmlpatterns/recipes/files/mushroomSoup.xq
new file mode 100644
index 00000000..b1fee349
--- /dev/null
+++ b/examples/xmlpatterns/recipes/files/mushroomSoup.xq
@@ -0,0 +1,5 @@
+(: All ingredients for Mushroom Soup. :)
+declare variable $inputDocument external;
+
+doc($inputDocument)/cookbook/recipe[@xml:id = "MushroomSoup"]/ingredient/
+<p>{@name, @quantity}</p>
diff --git a/examples/xmlpatterns/recipes/files/preparationLessThan30.xq b/examples/xmlpatterns/recipes/files/preparationLessThan30.xq
new file mode 100644
index 00000000..d74a4eb9
--- /dev/null
+++ b/examples/xmlpatterns/recipes/files/preparationLessThan30.xq
@@ -0,0 +1,9 @@
+(: All recipes taking 10 minutes or less to prepare. :)
+declare variable $inputDocument external;
+
+doc($inputDocument)/cookbook/recipe/time[@unit = "minutes" and xs:integer(@quantity) <= 10]/
+<p>
+ {
+ concat(../title, ' (', @quantity, ' ', @unit, ')')
+ }
+</p>
diff --git a/examples/xmlpatterns/recipes/files/preparationTimes.xq b/examples/xmlpatterns/recipes/files/preparationTimes.xq
new file mode 100644
index 00000000..cb4217ff
--- /dev/null
+++ b/examples/xmlpatterns/recipes/files/preparationTimes.xq
@@ -0,0 +1,5 @@
+(: All recipes with preparation times. :)
+declare variable $inputDocument external;
+
+doc($inputDocument)/cookbook/recipe/
+<recipe title="{title}" time="{time/@quantity} {time/@unit}"/>