First cut. Distintly raw around the edges:
* Assumes it will be running in /home/ali/wk/slashem/web.scripts
* Assumes cache directory will be in topdir
* No build system (simple compiling and linking against libxml2)
* No configure system (eg., tagsoup)
* Output XML untested
* Doesn't set bugzilla maintainer or exporter
* Handling of artifact priorities and resolution is suspect
3 <!-- This stylesheet extracts some details of attachments from the artifact
4 history of a sourceforge project export. -->
6 <xsl:stylesheet version="1.0"
7 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8 xmlns:xi="http://www.w3.org/2001/XInclude">
10 <xsl:import href="sf2bz.xsl"/>
12 <!-- Process a sourceforge artifact, outputting attachments as found -->
13 <xsl:template name="process-artifact">
14 <xsl:apply-templates/>
16 select="field[@name='artifact_history']/history[field[@name='field_name']='File Added']">
17 <xsl:variable name="file_id"
18 select="substring-before(field[@name='old_value'],':')"/>
20 <!-- isobsolete is an attribute of bugzilla:attachment, but that
21 proves hard to deal with so we treat it as a node and fix it
22 up in attachment_post.xsl -->
24 <xsl:value-of select="number(boolean(../history[field[@name='field_name']='File Deleted' and substring-before(field[@name='old_value'],':')=$file_id]))"/>
27 <xsl:value-of select="$file_id"/>
30 <xsl:call-template name="bugzilla-timestamp">
31 <xsl:with-param name="secs" select="field[@name='entrydate']"/>
36 select="substring-after(field[@name='old_value'],': ')"/>
42 <xsl:template match="project_export">
44 <xsl:apply-templates/>
48 <xsl:template match="artifacts">
49 <xsl:apply-templates/>
52 <xsl:template match="artifact">
53 <xsl:variable name="type"
54 select="normalize-space(field[@name='artifact_type'])"/>
56 <xsl:when test="$type = 'Feature Requests'">
57 <xsl:call-template name="process-artifact"/>
59 <xsl:when test="$type = 'Patches'">
60 <xsl:call-template name="process-artifact"/>
62 <xsl:when test="$type = 'Bugs'">
63 <xsl:call-template name="process-artifact"/>
68 <xsl:template match="node()|text()" priority="-1"></xsl:template>