all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue