Hello
Le lundi 14 septembre 2009 à 14:37, Andrew Errington a écrit :
> So far I have a very simple XSLT that will find all nodes (or ways,
> because a restaurant could be a node or an area) that have a tag with an
> attribute k="amenity" and an attribute v="restaurant".  I can query the
> parent node and get its id, but I really want to query the sibling nodes,
> find the one that has attribute k="name" and print the value of attribute
> v (the name itself).

You can select those elements with an xpath like

node[t...@k='amenity' and @v='restaurant']]/t...@k='name']

for more informations, see
http://www.w3.org/TR/xpath
http://www.w3.org/TR/xslt

If you only want the names as a flat text file, you can use a command line 
tool like xmlstarlet (http://xmlstar.sourceforge.net) and do something like

xml sel -t -m "//node[t...@k='amenity' and @v='restaurant']]/t...@k='name']"
        -v "@v" -o "
" file.osm

-- 
Renaud Michel

_______________________________________________
newbies mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/newbies

Reply via email to