XML/XPath: Difference between revisions
Content added Content deleted
Line 368:
<lang xquery>
(:
let $firstItem := //item[1]▼
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) :)
Line 394 ⟶ 398:
<price>14.50</price>
<description>Makes you invisible</description>
</item>
</firstItem>
|