get_users.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
<xsl:stylesheet version="1.0"
ali@0
     3
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
ali@0
     4
		xmlns:exsl="http://exslt.org/common"
ali@0
     5
		extension-element-prefixes="exsl">
ali@0
     6
ali@0
     7
<xsl:variable name="users">
ali@0
     8
  <xsl:for-each select="//artifact/field[@name='submitted_by' or @name='assigned_to']">
ali@0
     9
    <user><xsl:value-of select="normalize-space(.)"/></user>
ali@0
    10
  </xsl:for-each>
ali@0
    11
  <xsl:for-each select="//artifact/field[@name='artifact_history']/history/field[@name='mod_by']">
ali@0
    12
    <user><xsl:value-of select="normalize-space(.)"/></user>
ali@0
    13
  </xsl:for-each>
ali@0
    14
  <xsl:for-each select="//artifact/field[@name='artifact_messages']/message/field[@name='user_name']">
ali@0
    15
    <user><xsl:value-of select="normalize-space(.)"/></user>
ali@0
    16
  </xsl:for-each>
ali@0
    17
</xsl:variable>
ali@0
    18
ali@0
    19
<xsl:variable name="sorted_users">
ali@0
    20
  <xsl:for-each select="exsl:node-set($users)/user">
ali@0
    21
    <xsl:sort/>
ali@0
    22
    <xsl:copy-of select="."/>
ali@0
    23
  </xsl:for-each>
ali@0
    24
</xsl:variable>
ali@0
    25
ali@0
    26
<xsl:template match="/">
ali@0
    27
  <users>
ali@0
    28
    <xsl:for-each select="exsl:node-set($sorted_users)/user">
ali@0
    29
      <xsl:if test="not(. = following-sibling::user[1])">
ali@0
    30
	<user>
ali@0
    31
	  <xsl:value-of select="."/>
ali@0
    32
	  <xsl:text>@users.sourceforge.net</xsl:text>
ali@0
    33
	</user>
ali@0
    34
      </xsl:if>
ali@0
    35
    </xsl:for-each>
ali@0
    36
  </users>
ali@0
    37
</xsl:template>
ali@0
    38
ali@0
    39
</xsl:stylesheet>