Created
January 22, 2014 11:06
-
-
Save andrewshadura/8556971 to your computer and use it in GitHub Desktop.
XSLT transformations to fix Slovak addresses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:exslt="http://exslt.org/common" | |
xmlns:math="http://exslt.org/math" | |
xmlns:date="http://exslt.org/dates-and-times" | |
xmlns:func="http://exslt.org/functions" | |
xmlns:set="http://exslt.org/sets" | |
xmlns:str="http://exslt.org/strings" | |
xmlns:dyn="http://exslt.org/dynamic" | |
xmlns:saxon="http://icl.com/saxon" | |
xmlns:xalanredirect="org.apache.xalan.xslt.extensions.Redirect" | |
xmlns:xt="http://www.jclark.com/xt" | |
xmlns:libxslt="http://xmlsoft.org/XSLT/namespace" | |
xmlns:test="http://xmlsoft.org/XSLT/" | |
extension-element-prefixes="exslt math date func set str dyn saxon xalanredirect xt libxslt test" | |
exclude-result-prefixes="math str"> | |
<xsl:output omit-xml-declaration="no" indent="yes"/> | |
<xsl:param name="inputFile">-</xsl:param> | |
<xsl:template match="/"> | |
<xsl:call-template name="t1"/> | |
</xsl:template> | |
<xsl:template name="t1"> | |
<osm version='0.6' upload='true' generator='JOSM'> | |
<xsl:copy-of select="/osm/bounds"/> | |
<xsl:copy-of select="/osm/node"/> | |
<xsl:for-each select="/osm/way/tag[@k='addr:conscriptionnumber']/../tag[@k='addr:streetnumber']/.."> | |
<way id='{@id}' version='{number(@version+0)}' changeset='{@changeset}' action='modify'> | |
<xsl:copy-of select="./nd"/> | |
<xsl:copy-of select="./tag[@k!='addr:housenumber']"/> | |
<tag k="addr:housenumber" v="{./tag[@k='addr:streetnumber']/@v}"/> | |
</way> | |
</xsl:for-each> | |
<xsl:copy-of select="/osm/relation"/> | |
</osm> | |
</xsl:template> | |
</xsl:stylesheet> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:exslt="http://exslt.org/common" | |
xmlns:math="http://exslt.org/math" | |
xmlns:date="http://exslt.org/dates-and-times" | |
xmlns:func="http://exslt.org/functions" | |
xmlns:set="http://exslt.org/sets" | |
xmlns:str="http://exslt.org/strings" | |
xmlns:dyn="http://exslt.org/dynamic" | |
xmlns:saxon="http://icl.com/saxon" | |
xmlns:xalanredirect="org.apache.xalan.xslt.extensions.Redirect" | |
xmlns:xt="http://www.jclark.com/xt" | |
xmlns:libxslt="http://xmlsoft.org/XSLT/namespace" | |
xmlns:test="http://xmlsoft.org/XSLT/" | |
extension-element-prefixes="exslt math date func set str dyn saxon xalanredirect xt libxslt test" | |
exclude-result-prefixes="math str"> | |
<xsl:output omit-xml-declaration="no" indent="yes"/> | |
<xsl:param name="inputFile">-</xsl:param> | |
<xsl:template match="/"> | |
<xsl:call-template name="t1"/> | |
</xsl:template> | |
<xsl:template name="t1"> | |
<osm version='0.6' upload='true' generator='JOSM'> | |
<xsl:copy-of select="/osm/bounds"/> | |
<xsl:copy-of select="/osm/node"/> | |
<xsl:for-each select="/osm/way/tag[@k='addr:conscriptionnumber']/.."> | |
<way id='{@id}' version='{number(@version+0)}' changeset='{@changeset}' action='modify'> | |
<xsl:copy-of select="./nd"/> | |
<xsl:copy-of select="./tag[@k!='addr:housenumber']"/> | |
<tag k="addr:housenumber" v="{./tag[@k='addr:conscriptionnumber']/@v}{substring('/',0 != string-length(./tag[@k='addr:streetnumber']/@v),1)}{./tag[@k='addr:streetnumber']/@v}"/> | |
</way> | |
</xsl:for-each> | |
<xsl:copy-of select="/osm/relation"/> | |
</osm> | |
</xsl:template> | |
</xsl:stylesheet> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment