-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix-osm.xsl
30 lines (26 loc) · 888 Bytes
/
fix-osm.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output doctype-system="osm.dtd" indent="yes"/>
<xsl:template match="@id">
<xsl:attribute name="id">
<xsl:value-of select="concat(name(parent::node()), .)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@ref">
<xsl:variable name="parent" select="name(parent::node())"/>
<xsl:attribute name="ref">
<xsl:choose>
<xsl:when test="$parent = 'nd'">node</xsl:when>
<xsl:when test="$parent = 'member'">
<xsl:value-of select="../@type"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:transform>