summaryrefslogtreecommitdiffstats
path: root/packaging/insert-changelog.xsl
blob: 779b4a3efd48d95f42210a2656dcde9dcc1e5a53 (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
65
66
<!-- 

Add a RPM changelog entry to a document's rpm-info.xml file.
The following stringparam values are expected in this file:
  detail : Text describing the change
    date : Date of change, formatted properly:
             For role="rpm", date format is +"%a %b %d %Y"
             For role="doc", date format is +"%Y-%m-%d"
  number : Number for change, formatted properly:
             For role="rpm", integer release number
             For role="doc", version number for document
  person : ID for responsible entity, drawn from current <colophon>
    role : "doc" or "rpm", indicating type of change

-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output encoding="UTF-8" indent="yes" method="xml"
    omit-xml-declaration="no" standalone="no" version="1.0"
    doctype-system="../docs-common/packaging/rpm-info.dtd"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="rpm-info">
    <xsl:element name="rpm-info">
      <xsl:for-each select="*">
	<xsl:choose>
	  <xsl:when test="self::changelog"><xsl:call-template name="clog"/></xsl:when>
	  <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
	</xsl:choose>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>

  <xsl:template name="clog">
    <xsl:element name="changelog" use-attribute-sets="clog">
      <xsl:element name="revision" use-attribute-sets="rev">
	<xsl:element name="author" use-attribute-sets="auth"/>
	<xsl:element name="details"><xsl:value-of
	select="$detail"/></xsl:element>
      </xsl:element>
      <xsl:copy-of select="*"/>
    </xsl:element>
  </xsl:template>


  <xsl:attribute-set name="clog">
    <xsl:attribute name="order">newest-first</xsl:attribute>
  </xsl:attribute-set>

  <xsl:attribute-set name="rev">
    <xsl:attribute name="date"><xsl:value-of select="$date"/></xsl:attribute>
    <xsl:attribute name="number"><xsl:value-of
    select="$number"/></xsl:attribute>
    <xsl:attribute name="role"><xsl:value-of select="$role"/></xsl:attribute>
  </xsl:attribute-set>

  <xsl:attribute-set name="auth">
    <xsl:attribute name="worker"><xsl:value-of
    select="$person"/></xsl:attribute>
  </xsl:attribute-set>

</xsl:stylesheet>