\
Source Code
Configuration / Options
XML Version File
I will need to update this section but the basic idea is that if you want
to enter version information in XML then probably the simplest way is to use
a stylesheet to generate a "normal" version file.
A command such as the following can be used to generate the version file
from it's XML format:
msxsl.exe version.xml xml2ver.xsl > version.ver
The "msxsl.exe" program actually produces unicode output which MAKEMSI
won't like, you can convert the output using the "TYPE" command and redirecting the output.
The "MAKEMSI_HOOK_JUST_BEFORE_VERSION_FILE_PROCESSING_STARTS" hook can
be used to define your processing:
#( ''
#define MAKEMSI_HOOK_JUST_BEFORE_VERSION_FILE_PROCESSING_STARTS
;--- Conversion code here... --------------------------------------------
#)
This is some sample XML:
<?xml version="1.0" encoding="utf-8"?>
<MAKEMSI>
<ProductInformation>
<Name>Fred</Name>
<Version>1.2.3.4</Version>
<Comments>
This is a shjdh dsjh jkfsdhjf hkjf hdsjh fsjh fjkh fjk
hsdjkfhds fd
2nd line jklfdjlk sdlkjfkldsjf klsdjlkfj dsl
3rd line hdjhdkjhdjkdhjkdhhdjkhdjk
</Comments>
<SomeAsYetUnknownKeyword>NeedsIteration required on "ProductInformation"</SomeAsYetUnknownKeyword>
</ProductInformation>
<Changes>
<Change>
<Version>4.3.2.1</Version>
<Date>1 Feb 2005</Date>
<Desc>The changes for the current release.</Desc>
</Change>
<Change>
<Version>4.3.2.0</Version>
<Date>1 Jan 2005</Date>
<Desc>The changes text.</Desc>
</Change>
</Changes>
</MAKEMSI>
This is one possible form of a stylesheet:
<?xml version="1.0"?>
<!--
Thanks to Mike Blake-Knox for producing the original basic code.
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- text (non-XML output) -->
<xsl:output method="text"/>
<!-- template that matches whole document -->
<xsl:template match="MAKEMSI">
<!-- Output a header comment -->
<xsl:text>;=====================================================
;======== Automatically Generated file ===============
;=====================================================
;=== FROM :
;=== DATED: ?
;=====================================================


;##################[Product Information Section of the ".VER" file]############
</xsl:text>
<!-- Work though all sub nodes of "ProductInformation" -->
<xsl:for-each select="ProductInformation">
<xsl:for-each select="*">
<!-- Start a new line -->
<xsl:text>
</xsl:text>
<!-- Output KEYWORD name -->
<xsl:value-of select="name()"/>
<!-- "=" -->
<xsl:text> = </xsl:text>
<!-- Output KEYWORD value (convert newlines to spaces) -->
<xsl:value-of select="normalize-space( translate(current(), '
', ' '))"/>
</xsl:for-each>
</xsl:for-each>
<!-- A few new lines -->
<xsl:text>


</xsl:text>
<!-- For each change history item -->
<xsl:for-each select="Changes">
<xsl:for-each select="Change">
<xsl:text>


;##################[Change]####################################################
</xsl:text>
<xsl:for-each select="*">
<!-- Start a new line -->
<xsl:text>
</xsl:text>
<!-- Output KEYWORD (convert "Desc" to "Comments") -->
<xsl:choose>
<xsl:when test="name() = "Desc"">
<!-- Output "COMMENTS" as keyword -->
<xsl:text>Comments</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- Output original KEYWORD -->
<xsl:value-of select="name()"/>
</xsl:otherwise>
</xsl:choose>
<!-- Output ":" -->
<xsl:text> : </xsl:text>
<!-- Output the value -->
<xsl:value-of select="current()"/>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<!-- A few new lines -->
<xsl:text>


</xsl:text>
</xsl:template>
</xsl:stylesheet>