summaryrefslogtreecommitdiffstats
path: root/tools/src/announcement2site.xsl
blob: 52a41cd9c51ecea0d7e2cc3a26e9addc5304aeec (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:lxslt="http://xml.apache.org/xslt"
    xmlns:my-ext="ext1"
    extension-element-prefixes="my-ext"
>

  <xsl:output method="xml" indent="yes"/>
  <!--The component and its script are in the lxslt namespace and define the 
                  implementation of the extension.-->
                <lxslt:component prefix="my-ext" elements="timelapse" functions="getdate">
                  <lxslt:script lang="javascript">
		    var month = new Array (
		      "January",
		      "February",
		      "March",
		      "April",
		      "May",
		      "June",
		      "July",
		      "August",
		      "September",
		      "October",
		      "November",
		      "December"
		    );

                    function getdate()
                    {
		      var d = new Date();
		      var mo = month[d.getMonth()];
		      var dy = d.getDate();
		      var yr = d.getFullYear();
		      var dateString = dy + " " + mo + " " + yr;
                      return dateString;
                    }
                  </lxslt:script>
                </lxslt:component>

  <xsl:template match="changes">
    <xsl:variable name="version" select="@version"/>
    <xsl:apply-templates select="document(@file,/)/changes/release[attribute::version=string($version)]"/>
  </xsl:template>

  <xsl:template match="announcement">
    <h3><xsl:value-of select="my-ext:getdate()"/> - <xsl:value-of select="title"/><xsl:text> Released</xsl:text></h3>
    <xsl:apply-templates select="abstract"/>

    <xsl:for-each select="project">
      <p><b>About <xsl:value-of select="title"/>:</b>
        <xsl:apply-templates select="."/>
      </p>
    </xsl:for-each>

    <hr noshade="" size="1"/>
  </xsl:template>

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

    <p>For more information about <xsl:value-of select="title"/>, please go to
    <a><xsl:attribute name="href"><xsl:value-of select="@site"/></xsl:attribute>
    <xsl:value-of select="@site"/></a>.</p>

    <!-- ignore changelog for site -->
  </xsl:template>

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

  <xsl:template match="description">
    <xsl:choose>
      <xsl:when test="para">
        <xsl:apply-templates select="para[position()=1]/node()"/>
	<xsl:apply-templates select="para[position()>1]"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

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

  <xsl:template match="ulink">
    <a href="{@uri}"><xsl:value-of select="."/></a>
  </xsl:template>
</xsl:stylesheet>