blob: 3e5a5b3d3045b42f35570da2bbb7d677da3bf633 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
extension-element-prefixes="exslt">
<xsl:template name="fullname">
<xsl:param name="nick" select="none"/>
<xsl:param name="fallback" select="false"/>
<xsl:param name="parent" select="false"/>
<xsl:param name="rollcall" select='document("/proj/en/devrel/roll-call/userinfo.xml")'/>
<xsl:if test='not($nick="none")'>
<xsl:variable name="user" select='exslt:node-set($rollcall)//user[@username=translate($nick, "ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")]'/>
<xsl:choose>
<xsl:when test='$user'>
<xsl:for-each select='$user'>
<xsl:if test='$parent="true"'><xsl:text>(</xsl:text></xsl:if>
<xsl:choose>
<xsl:when test="realname/@fullname">
<xsl:value-of select="realname/@fullname"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="realname/firstname/text()"/>
<xsl:text> </xsl:text>
<xsl:value-of select="realname/familyname/text()"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test='$parent="true"'><xsl:text>)</xsl:text></xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:if test='$fallback="true"'>
<xsl:if test='$parent="true"'><xsl:text>(</xsl:text></xsl:if>
<xsl:value-of select="$nick"/>
<xsl:if test='$parent="true"'><xsl:text>)</xsl:text></xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- Extract file name from a link -->
<xsl:template name="filename">
<xsl:param name="path"/>
<xsl:choose>
<!-- $path is a directory, assume file name is index.xml -->
<xsl:when test="'/'=substring($path,string-length($path))">index.xml</xsl:when>
<xsl:when test="contains($path, '/')">
<xsl:call-template name="filename">
<xsl:with-param name="path" select="substring-after($path, '/')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$path"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
|