sf2bz.xsl
author ali@yendor.vm.bytemark.co.uk
Thu Nov 16 08:30:26 2006 +0000 (2006-11-16)
changeset 0 ae7b3fa753dc
permissions -rw-r--r--
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
ali@0
     1
<?xml version="1.0"?>
ali@0
     2
ali@0
     3
<!-- A set of templates used in multiple stylesheets -->
ali@0
     4
ali@0
     5
<xsl:stylesheet version="1.0"
ali@0
     6
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
ali@0
     7
		xmlns:date="http://exslt.org/dates-and-times"
ali@0
     8
		extension-element-prefixes="date">
ali@0
     9
ali@0
    10
<!-- Convert a UNIX-style date (seconds since 1 Jan 1970) to
ali@0
    11
     the timestamp format used by bugzilla: %Y-%m-%d %X -->
ali@0
    12
<xsl:template name="bugzilla-timestamp">
ali@0
    13
  <xsl:param name="secs" select="."/>
ali@0
    14
  <xsl:variable name="dt" select="date:add('1970',concat('PT',$secs,'S'))"/>
ali@0
    15
  <xsl:value-of select="date:year($dt)"/>
ali@0
    16
  <xsl:text>-</xsl:text>
ali@0
    17
  <xsl:value-of select="format-number(date:month-in-year($dt),'00')"/>
ali@0
    18
  <xsl:text>-</xsl:text>
ali@0
    19
  <xsl:value-of select="format-number(date:day-in-month($dt),'00')"/>
ali@0
    20
  <xsl:text> </xsl:text>
ali@0
    21
  <xsl:value-of select="format-number(date:hour-in-day($dt),'00')"/>
ali@0
    22
  <xsl:text>:</xsl:text>
ali@0
    23
  <xsl:value-of select="format-number(date:minute-in-hour($dt),'00')"/>
ali@0
    24
  <xsl:text>:</xsl:text>
ali@0
    25
  <xsl:value-of select="format-number(date:second-in-minute($dt),'00')"/>
ali@0
    26
  <xsl:text> UTC</xsl:text>
ali@0
    27
</xsl:template>
ali@0
    28
ali@0
    29
</xsl:stylesheet>