<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	  xmlns:gavid="urn:avira.com:gavid" >
	  
<xsl:template match="/">
<file xmlns:gavid="urn:avira.com:gavid">
    <xsl:apply-templates/>
</file>
</xsl:template>


<xsl:template match="event[@name='download']">
<xsl:if test="mime = 'application/x-msdownload' or mime = 'application/x-msdos-program' or extension = 'msi'">
	<integrity gavid:merge="first"><xsl:value-of select="integrity"/></integrity>
	<download gavid:merge="list">
		<xsl:attribute name="time"><xsl:value-of select="time"/></xsl:attribute>
		<url><xsl:value-of select="url"/></url>
		<xsl:apply-templates select="categories"/>
	</download>
	<mime gavid:merge="first"><xsl:value-of select="mime"/></mime>
	<extension><xsl:value-of select="extension"/></extension>
</xsl:if>
</xsl:template>

<xsl:template match="event">
	<xsl:for-each select="*">
	<xsl:copy>
		<xsl:attribute name="gavid:merge">last</xsl:attribute>
		<xsl:apply-templates select="@* | node()"/>
	</xsl:copy>
	</xsl:for-each>
</xsl:template>

<xsl:template match="@* | node()">
	<xsl:copy>
		<xsl:apply-templates select="@* | node()"/>
	</xsl:copy>
</xsl:template>


</xsl:stylesheet>
