user_names.xsl
changeset 0 ae7b3fa753dc
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/user_names.xsl	Thu Nov 16 08:30:26 2006 +0000
     1.3 @@ -0,0 +1,61 @@
     1.4 +<?xml version="1.0"?>
     1.5 +
     1.6 +<xsl:stylesheet version="1.0"
     1.7 +		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     1.8 +		xmlns:xhtml="http://www.w3.org/1999/xhtml"
     1.9 +		xmlns:exsl="http://exslt.org/common"
    1.10 +		extension-element-prefixes="exsl"
    1.11 +		exclude-result-prefixes="xhtml">
    1.12 +
    1.13 +<xsl:variable name="users">
    1.14 +  <xsl:for-each select="//users/user">
    1.15 +    <user>
    1.16 +      <xsl:copy-of select="@name"/>
    1.17 +      <xsl:value-of select="."/>
    1.18 +    </user>
    1.19 +  </xsl:for-each>
    1.20 +  <xsl:for-each select="//xhtml:td[xhtml:b='Submitted By:' and xhtml:a]">
    1.21 +    <xsl:element name="user">
    1.22 +      <xsl:attribute name="name">
    1.23 +	<xsl:for-each select="text()">
    1.24 +	  <xsl:if test="contains(., '-')">
    1.25 +	    <xsl:value-of select="normalize-space(substring-before(., '-'))"/>
    1.26 +	  </xsl:if>
    1.27 +	</xsl:for-each>
    1.28 +      </xsl:attribute>
    1.29 +      <xsl:value-of select="xhtml:a"/>
    1.30 +      <xsl:text>@users.sourceforge.net</xsl:text>
    1.31 +    </xsl:element>
    1.32 +  </xsl:for-each>
    1.33 +  <xsl:for-each select="//xhtml:table[xhtml:tr/xhtml:td[normalize-space(.)='Login Name:'] and xhtml:tr/xhtml:td[normalize-space(.)='Publicly Displayed Name:']]">
    1.34 +    <xsl:element name="user">
    1.35 +      <xsl:attribute name="name">
    1.36 +	<xsl:value-of select="normalize-space(xhtml:tr/xhtml:td[normalize-space(.)='Publicly Displayed Name:']/following-sibling::xhtml:td)"/>
    1.37 +      </xsl:attribute>
    1.38 +	<xsl:value-of select="normalize-space(xhtml:tr/xhtml:td[normalize-space(.)='Login Name:']/following-sibling::xhtml:td)"/>
    1.39 +      <xsl:text>@users.sourceforge.net</xsl:text>
    1.40 +    </xsl:element>
    1.41 +  </xsl:for-each>
    1.42 +</xsl:variable>
    1.43 +
    1.44 +<xsl:variable name="sorted_users">
    1.45 +  <xsl:for-each select="exsl:node-set($users)/user">
    1.46 +    <xsl:sort/>
    1.47 +    <xsl:copy-of select="."/>
    1.48 +  </xsl:for-each>
    1.49 +</xsl:variable>
    1.50 +
    1.51 +<xsl:template match="/">
    1.52 +  <users>
    1.53 +    <xsl:for-each select="exsl:node-set($sorted_users)/user">
    1.54 +      <xsl:if test="not(. = following-sibling::user[1])">
    1.55 +	<xsl:copy>
    1.56 +	  <xsl:copy-of select="@name"/>
    1.57 +	  <xsl:value-of select="."/>
    1.58 +	</xsl:copy>
    1.59 +      </xsl:if>
    1.60 +    </xsl:for-each>
    1.61 +  </users>
    1.62 +</xsl:template>
    1.63 +
    1.64 +</xsl:stylesheet>