Hello!
I would like to share a small XSLT transform used to extract list of street names from a particular OSM file. Browsing such lists appear to be very useful for tracking typos or comparing with official geodetic databases. Any comments will be appreciated. Generated lists are sorted and with duplicates removed. Tested on xsltproc.
If you want to show duplicate names (and boost speed of transform), remove
and not(./tag[@k='name']/@v=following::tag[@k='name']/@v
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:for-each select="/osm/way">
<xsl:sort select="./tag[@k='name']/@v" />
<xsl:if test="./tag[@k='highway'] and ./tag[@k='name'] and not(./tag[@k='name']/@v=following::tag[@k='name']/@v)">
<xsl:value-of select="./tag[@k='name']/@v"/>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>