Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/XML-XPath/XQuery/xml-xpath-1.xquery
Normal file
19
Task/XML-XPath/XQuery/xml-xpath-1.xquery
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(:
|
||||
1. Retrieve the first "item" element
|
||||
Notice the braces around //item. This evaluates first all item elements and then retrieving the first one.
|
||||
Whithout the braces you get the first item for every section.
|
||||
:)
|
||||
let $firstItem := (//item)[1]
|
||||
|
||||
(: 2. Perform an action on each "price" element (print it out) :)
|
||||
let $price := //price/data(.)
|
||||
|
||||
(: 3. Get an array of all the "name" elements :)
|
||||
let $names := //name
|
||||
|
||||
return
|
||||
<result>
|
||||
<firstItem>{$firstItem}</firstItem>
|
||||
<prices>{$price}</prices>
|
||||
<names>{$names}</names>
|
||||
</result>
|
||||
17
Task/XML-XPath/XQuery/xml-xpath-2.xquery
Normal file
17
Task/XML-XPath/XQuery/xml-xpath-2.xquery
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<result>
|
||||
<firstItem>
|
||||
<item upc="123456789" stock="12">
|
||||
<name>Invisibility Cream</name>
|
||||
<price>14.50</price>
|
||||
<description>Makes you invisible</description>
|
||||
</item>
|
||||
</firstItem>
|
||||
<prices>14.50 23.99 4.95 3.56</prices>
|
||||
<names>
|
||||
<name>Invisibility Cream</name>
|
||||
<name>Levitation Salve</name>
|
||||
<name>Blork and Freen Instameal</name>
|
||||
<name>Grob winglets</name>
|
||||
</names>
|
||||
</result>
|
||||
Loading…
Add table
Add a link
Reference in a new issue