how to refactor xslt processing

on opensuse 13.1 i try to do some gis-works with a large file: france-latest.osm.bz2 which i gathered from here: http://download.geofabrik.de/europe.html

what do i do with that file france-latest.osm.bz2

    bzcat france-latest.osm.bz2

what is aimed? i want to extract all things that belong to the POI restaurant which is
long lat
name
adress
etc - etx.

i have the following things up and running:

package perl-XML-Twig and run xml_split

with a command available on openSUSE to split xml files named xml_split (it is part of the package perl-XML-Twig) Now we try to run the following command (I hope we have enough hard disk space since the output is roughly 20GB).

 bzcat france.osm.bz2 | xml_split -s 100M -b france -n 3 -

this will result in a bunch of 100 Mb large xml files france-001.xml,france-002.xml and so on. Weu then have the xslt (the name of the root element) and of course we will need a loop in the bash to process the several files and collect all the results together.


<xsl:stylesheet version = '1.0'
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:xml_split="http://xmltwig.com/xml_split"
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

    <xsl:output method="text" encoding="UTF-8"/>
    <xsl:template match="/">

            <xsl:for-each select="xml_split:root/node/tag[@k='amenity' and @v='restaurant']">
            <xsl:value-of select="../@id"/>
            <xsl:text>	</xsl:text>
            <xsl:value-of select="../@lat"/>
            <xsl:text>	</xsl:text>
            <xsl:value-of select="../@lon"/>
            <xsl:text>	</xsl:text>
            <xsl:for-each select="../tag[@k='name']">
                <xsl:value-of select="@v"/>
            </xsl:for-each>
            <xsl:text>
</xsl:text>
        </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>



question: what do i need to get all the aimed data out of the dataset - i.e.

long lat
name
adress
etc - etx.

here below we have a data-chunk out of the xml-file that we have parsed: see it


    <node id="52768810" lat="48.2044749" lon="11.3249434" version="7" changeset="9490517" user="wheelmap_visitor" uid="290680" timestamp="2011-10-07T20:24:46Z">
        <tag k="addr:city" v="Olching" />
        <tag k="addr:country" v="DE" />
        <tag k="addr:housenumber" v="72" />
        <tag k="addr:postcode" v="82140" />
        <tag k="addr:street" v="Hauptstra├če" />
        <tag k="amenity" v="restaurant" />
        <tag k="cuisine" v="mexican" />
        <tag k="email" v="info@cantina-olching.de" />
        <tag k="name" v="La Cantina" />
        <tag k="opening_hours" v="Mo-Su 17:00-01:00" />
        <tag k="phone" v="+49 (8142) 444393" />
        <tag k="website" v="http://www.cantina-olching.com/" />
        <tag k="wheelchair" v="no" />

well - how to get all the data out of the above mentioned file with the xslt-processingon opensuse 13.1 i try to do some gis-works with a large file: france-latest.osm.bz2 which i gathered from here: http://download.geofabrik.de/europe.html

what do i do with that file france-latest.osm.bz2

    bzcat france-latest.osm.bz2

what is aimed? i want to extract all things that belong to the POI restaurant which is
long lat
name
adress
etc - etx.

i have the following things up and running:

package perl-XML-Twig and run xml_split

with a command available on openSUSE to split xml files named xml_split (it is part of the package perl-XML-Twig) Now we try to run the following command (I hope we have enough hard disk space since the output is roughly 20GB).

 bzcat france.osm.bz2 | xml_split -s 100M -b france -n 3 -

this will result in a bunch of 100 Mb large xml files france-001.xml,france-002.xml and so on. Weu then have the xslt (the name of the root element) and of course we will need a loop in the bash to process the several files and collect all the results together.


<xsl:stylesheet version = '1.0'
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:xml_split="http://xmltwig.com/xml_split"
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

    <xsl:output method="text" encoding="UTF-8"/>
    <xsl:template match="/">

            <xsl:for-each select="xml_split:root/node/tag[@k='amenity' and @v='restaurant']">
            <xsl:value-of select="../@id"/>
            <xsl:text>	</xsl:text>
            <xsl:value-of select="../@lat"/>
            <xsl:text>	</xsl:text>
            <xsl:value-of select="../@lon"/>
            <xsl:text>	</xsl:text>
            <xsl:for-each select="../tag[@k='name']">
                <xsl:value-of select="@v"/>
            </xsl:for-each>
            <xsl:text>
</xsl:text>
        </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>



question: what do i need to get all the aimed data out of the dataset - i.e.

long lat
name
adress
etc - etx.

here below we have a data-chunk out of the xml-file that we have parsed: see it


    <node id="52768810" lat="48.2044749" lon="11.3249434" version="7" changeset="9490517" user="wheelmap_visitor" uid="290680" timestamp="2011-10-07T20:24:46Z">
        <tag k="addr:city" v="Olching" />
        <tag k="addr:country" v="DE" />
        <tag k="addr:housenumber" v="72" />
        <tag k="addr:postcode" v="82140" />
        <tag k="addr:street" v="Hauptstra├če" />
        <tag k="amenity" v="restaurant" />
        <tag k="cuisine" v="mexican" />
        <tag k="email" v="info@cantina-olching.de" />
        <tag k="name" v="La Cantina" />
        <tag k="opening_hours" v="Mo-Su 17:00-01:00" />
        <tag k="phone" v="+49 (8142) 444393" />
        <tag k="website" v="http://www.cantina-olching.com/" />
        <tag k="wheelchair" v="no" />

well - how to get all the data out of the above mentioned file with the xslt-processing