In this next part of the XML tutorial series, following on from
saving XML, we are converting the XML into other file formats such as
INI files or HTML files, LUA files or any text based format you can think of.
Visit the article
XML Document
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="application/xml" href="xml-to-ini.xsl"?>
<Server>
<Edit>
<File>
<Path>Trees\Tree24.x</Path>
<Position>14.5,57.5,241</Position>
</File>
<File>
<Path>Trees\Tree3.x</Path>
<Position>12.5,57.5,221</Position>
</File>
<File>
<Path>Plants\Flower23.x</Path>
<Position>12.5,53.5,221</Position>
</File>
</Edit>
</Server>
XSL Style sheet
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
[Request]<br />
TotalFiles=<xsl:value-of select="count(Server/Edit/File)"/><br />
<xsl:for-each select="Server/Edit/File"><br />
[File<xsl:number value="position()" format="1" />]<br />
Path=<xsl:value-of select="Path"/><br />
Position=<xsl:value-of select="Position"/><br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Result:
http://www.binarymodular.com/examples/xml-to-ini.xml
Another style sheet which creates a lua script out of XML:
http://www.binarymodular.com/examples/xml-to-lua.xml
Find out more about this stuff