user_names.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
<xsl:stylesheet version="1.0"
ali@0
     4
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
ali@0
     5
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
ali@0
     6
		xmlns:exsl="http://exslt.org/common"
ali@0
     7
		extension-element-prefixes="exsl"
ali@0
     8
		exclude-result-prefixes="xhtml">
ali@0
     9
ali@0
    10
<xsl:variable name="users">
ali@0
    11
  <xsl:for-each select="//users/user">
ali@0
    12
    <user>
ali@0
    13
      <xsl:copy-of select="@name"/>
ali@0
    14
      <xsl:value-of select="."/>
ali@0
    15
    </user>
ali@0
    16
  </xsl:for-each>
ali@0
    17
  <xsl:for-each select="//xhtml:td[xhtml:b='Submitted By:' and xhtml:a]">
ali@0
    18
    <xsl:element name="user">
ali@0
    19
      <xsl:attribute name="name">
ali@0
    20
	<xsl:for-each select="text()">
ali@0
    21
	  <xsl:if test="contains(., '-')">
ali@0
    22
	    <xsl:value-of select="normalize-space(substring-before(., '-'))"/>
ali@0
    23
	  </xsl:if>
ali@0
    24
	</xsl:for-each>
ali@0
    25
      </xsl:attribute>
ali@0
    26
      <xsl:value-of select="xhtml:a"/>
ali@0
    27
      <xsl:text>@users.sourceforge.net</xsl:text>
ali@0
    28
    </xsl:element>
ali@0
    29
  </xsl:for-each>
ali@0
    30
  <xsl:for-each select="//xhtml:table[xhtml:tr/xhtml:td[normalize-space(.)='Login Name:'] and xhtml:tr/xhtml:td[normalize-space(.)='Publicly Displayed Name:']]">
ali@0
    31
    <xsl:element name="user">
ali@0
    32
      <xsl:attribute name="name">
ali@0
    33
	<xsl:value-of select="normalize-space(xhtml:tr/xhtml:td[normalize-space(.)='Publicly Displayed Name:']/following-sibling::xhtml:td)"/>
ali@0
    34
      </xsl:attribute>
ali@0
    35
	<xsl:value-of select="normalize-space(xhtml:tr/xhtml:td[normalize-space(.)='Login Name:']/following-sibling::xhtml:td)"/>
ali@0
    36
      <xsl:text>@users.sourceforge.net</xsl:text>
ali@0
    37
    </xsl:element>
ali@0
    38
  </xsl:for-each>
ali@0
    39
</xsl:variable>
ali@0
    40
ali@0
    41
<xsl:variable name="sorted_users">
ali@0
    42
  <xsl:for-each select="exsl:node-set($users)/user">
ali@0
    43
    <xsl:sort/>
ali@0
    44
    <xsl:copy-of select="."/>
ali@0
    45
  </xsl:for-each>
ali@0
    46
</xsl:variable>
ali@0
    47
ali@0
    48
<xsl:template match="/">
ali@0
    49
  <users>
ali@0
    50
    <xsl:for-each select="exsl:node-set($sorted_users)/user">
ali@0
    51
      <xsl:if test="not(. = following-sibling::user[1])">
ali@0
    52
	<xsl:copy>
ali@0
    53
	  <xsl:copy-of select="@name"/>
ali@0
    54
	  <xsl:value-of select="."/>
ali@0
    55
	</xsl:copy>
ali@0
    56
      </xsl:if>
ali@0
    57
    </xsl:for-each>
ali@0
    58
  </users>
ali@0
    59
</xsl:template>
ali@0
    60
ali@0
    61
</xsl:stylesheet>