File: news.xsl

package info (click to toggle)
libembperl-perl 2.5.0-4%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 6,200 kB
  • ctags: 3,072
  • sloc: ansic: 21,387; perl: 14,496; cpp: 467; xml: 49; makefile: 32; sh: 24
file content (97 lines) | stat: -rw-r--r-- 3,158 bytes parent folder | download | duplicates (11)
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
93
94
95
96
97
<?xml version='1.0'?>

<!--
<!DOCTYPE xxx [
<!ENTITY % nbsp "&lt;![CDATA[&nbsp;]]&gt;" >
]>
-->

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:pod="http://axkit.org/ns/2000/pod2xml"
                xmlns="http://www.w3.org/TR/xhtml1/strict">


<xsl:output
   method="html"
   indent="no"
   encoding="iso-8859-1"
/>

<xsl:variable name="imagepath">/eg/images</xsl:variable>
<xsl:variable name="newswidth">152</xsl:variable>
<xsl:param name="numnews">10</xsl:param>

    <xsl:template match="/">                         
        <html>
            <head>
                <title><xsl:value-of select="pod/head/title"/></title>
            </head>
            <body>
                    <xsl:apply-templates select="/pod/sect1"/> 
            
            <xsl:if test="$numnews &lt; 9999">
                <a href="news/NEWS.xml?numnews=9999">more...</a>
            </xsl:if>
            </body>
        </html>
    </xsl:template>


    <xsl:template match="sect1">                         
        <table width="{$newswidth}" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="{$imagepath}/h_news.gif" width="{$newswidth}" height="19"/></td>
          </tr>
          <tr>
            <td><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></td>
          </tr>
          <tr>
            <td>
               <xsl:apply-templates select="item[position() &lt; $numnews]"/> 
            </td>
          </tr>
        </table>
    </xsl:template>



    <xsl:template match="item">                         
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td bgcolor="#327EA7"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>
                    <font color="#FFFFFF"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
                        <xsl:value-of select="itemtext"/>    
                    </font></b></font></td>
                </tr>
                <tr> 
                  <td bgcolor="#C2D9E5"><img src="{$imagepath}/linie-news.gif" width="{$newswidth}" height="4"/></td>
                </tr>
                <tr> 
                  <td bgcolor="#D2E9F5">
                    <table width="100%" border="0" cellspacing="0" cellpadding="3">
                      <tr>
                        <td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
                            <xsl:apply-templates/>
                        </font></td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
    </xsl:template>

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

    <xsl:template match="xlink">                         
            <xsl:element name="a">
                <xsl:attribute name="href">
                    <xsl:value-of select="@uri"/>
                </xsl:attribute>
                <xsl:value-of select="."/>
            </xsl:element>
    </xsl:template>

</xsl:stylesheet>