Skip to content

Instantly share code, notes, and snippets.

@fetis
Last active April 1, 2019 21:17
Show Gist options
  • Save fetis/15e7cf3c22885bda31d0472718fd3da5 to your computer and use it in GitHub Desktop.
Save fetis/15e7cf3c22885bda31d0472718fd3da5 to your computer and use it in GitHub Desktop.
Railway Empire tools. Export cities from Tile map to CSV file. You can import this file in Tome editor to update/create cities.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="text"></xsl:output>
<xsl:template match="/">ID;DisplayName;NameId;TownFounded;TownActive;TownFactory0;TownFactory1;TownFactory2;TownPopulation<xsl:text>
</xsl:text>
<xsl:apply-templates select="//objectgroup[contains(@name, 'city_')]"></xsl:apply-templates>
</xsl:template>
<xsl:template match="objectgroup">
<xsl:variable name="id" select="substring(@name, 6)"/>
<xsl:variable name="nameId" select="properties/property[@name = 'nameid']/@value"/>
<xsl:variable name="founded" select="properties/property[@name = 'founded']/@value"/>
<xsl:variable name="production1" select="properties/property[@name = 'production1']/@value"/>
<xsl:variable name="production2" select="properties/property[@name = 'production2']/@value"/>
<xsl:variable name="production3" select="properties/property[@name = 'production3']/@value"/>
<xsl:variable name="population" select="properties/property[@name = 'population']/@value"/>
<xsl:value-of select="string-join(($id, $id, $nameId, $founded, 'true', $production1,$production2, $production3, $population), ';')"/><xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment