如果我有这个简单的 file.xml:
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>
Lorenzo Vinci
</name>
<address>
Via Rosa Luxemburg 68 A, Imola
<state>
Italia
</state>
</address>
</employee>
<employee>
<name>
Marco Di Nicola
</name>
<address>
Via Venezia, Pescara
<state>
Italia
</state>
</address>
</employee>
<employee>
<name>
Luca Pompei
</name>
<address>
Via qualcosa, Londra
<state>
England
</state>
</address>
</employee>
</employees>
我想获取州名以“I”开头的所有员工。所以我写了查询:
let $emp := doc("employees.xml")
for $e in $emp//employee
let $state := $e/address/state
return starts-with($state, "I")
但函数开头总是返回false。我也试过
return starts-with(string($state), "I")
但它是一样的。我哪里错了?谢谢