Skip to content

Instantly share code, notes, and snippets.

@simonpoole
Created April 10, 2020 15:38
Show Gist options
  • Save simonpoole/b7425768b1b5cb317c6227c93c6839cd to your computer and use it in GitHub Desktop.
Save simonpoole/b7425768b1b5cb317c6227c93c6839cd to your computer and use it in GitHub Desktop.
xslt to renumber a OSM Notes file
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="xml"
indent="yes" />
<xsl:template match="@id" />
<xsl:template match="note">
<xsl:copy>
<xsl:attribute name="id">
<xsl:text>-</xsl:text>
<xsl:number />
</xsl:attribute>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment