我不确定为什么我无法从元素中获取纬度和经度属性。我可以从日期访问该值。
查询控制台:
xquery version "1.0-ml";
declare namespace md = "http://mynamespace";
for $row in /md:row
let $date := $row/md:date/text()
let $latitude := fn:string($row/md:geocode/attribute::latitude)
let $longitude := fn:string($row/md:geocode/@longitude)
return (
<tr>
<td>{$date}</td>
<td>{$latitude}</td>
<td>{$longitude}</td>
</tr>
)
XML文件示例:
<row _id="555" _uuid="01A580BD-49CB-41DD-8D4C-C83C6E86C688" _position="555" xmlns="http://mynamespace">
<type>NFS</type>
<date>2013-10-11T00:00:00</date>
<time>134</time>
<location>100 Penn St</location>
<city>Baltimore</city>
<county>Balto. City</county>
<zip>21201</zip>
<geocode human_address="{"address":"100 Penn St","city":"Baltimore","state":"","zip":"21201"}" latitude="39.28747052900047" longitude="-76.62597468299964" needs_recoding="false">
</geocode>
</row>