XML/XPath: Difference between revisions
Content added Content deleted
(→{{header|D}}: add implementation) |
No edit summary |
||
Line 364: | Line 364: | ||
Dim names = (From item In xml.XPathSelectElements("//name") Select item.Value).ToArray |
Dim names = (From item In xml.XPathSelectElements("//name") Select item.Value).ToArray |
||
=={{header|XQuery}}== |
|||
<lang xquery> |
|||
(: 1. Retrieve the first "item" element :) |
|||
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> |
|||
</lang> |
|||
=={{header|XSLT}}== |
=={{header|XSLT}}== |