summaryrefslogtreecommitdiffstats
path: root/packaging/templates.xsl
blob: 811a52d9eda347b1ced51b0ee6d72bae8336257f (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
63
64
<xsl:stylesheet version="1.0" xml:space="preserve" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:strip-space elements="*"/>

  <!-- Print the translated title of a document for language $lang -->
  <xsl:template name="get-title">
    <xsl:for-each select="/rpm-info/titles/translation">
      <xsl:choose>
	<xsl:when test="@lang = $lang">
	  <xsl:value-of select="title"/>
	</xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>

  <!-- Print the translated description of a document for language $lang -->
  <xsl:template name="get-desc">
    <xsl:for-each select="/rpm-info/titles/translation">
      <xsl:choose>
	<xsl:when test="@lang = $lang">
	  <xsl:value-of select="desc"/>
	</xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>

  <!-- Print a hierarchical entry for a given worker with id $who -->    
  <xsl:template name="human">
    <xsl:for-each select="/rpm-info/colophon/worker">
      <xsl:if test="@id = $who">
	<xsl:element name="surname">
	  <xsl:value-of select="@surname"/>
	</xsl:element>
	<xsl:element name="firstname">
	  <xsl:value-of select="@firstname"/>
	</xsl:element>
	<xsl:if test="@othername != ''">
	  <xsl:element name="othername">
	    <xsl:value-of select="@othername"/>
	  </xsl:element>
	</xsl:if>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
  
  <!-- Print a full name for a given worker with id $who -->
  <!-- DO NOT CHANGE SPACING! -->
  <xsl:template name="personname"><xsl:for-each
  select="/rpm-info/colophon/worker"><xsl:if test="@id = $who"><xsl:value-of
  select="@firstname"/> <xsl:if test="@othername != ''"><xsl:value-of
  select="@othername"/> </xsl:if><xsl:value-of
  select="@surname"/></xsl:if></xsl:for-each></xsl:template>

  <!-- Print a full name and email for a given worker with id $who -->
  <!-- DO NOT CHANGE SPACING! -->
  <xsl:template name="packager"><xsl:call-template
  name="personname"><xsl:with-param name="who"
  select="$who"/></xsl:call-template> &lt;<xsl:for-each
  select="/rpm-info/colophon/worker"><xsl:if test="@id = $who"><xsl:value-of
  select="@email"/></xsl:if></xsl:for-each>&gt;</xsl:template>



</xsl:stylesheet>