re:>返回40
区别以上例子
3 多重循环语句
ex:>
for $c in customers
for $o in orders
where $c.cust_id=$o.cust_id and $o.part_id="xx"
return $c.name
以上语句等价于sql语句
select customers.name from customers, orders
where customers.cust_id=orders.cust_id and orders.part_id="xx"
ex:>
for $book in bib.xml//book
let $title := $book/title
where $book/publisher = 'Addison-Wesley'
return
<bookInfo>{ $title }</bookInfo>
[xpath例子]
greetings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<greetings>
<greeting from="weiqi">Nihao!</greeting>