summaryrefslogtreecommitdiff
path: root/services.xsl
blob: 695adb6b4810bd51185d1e19c0e242bf8d74908a (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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0" 
  xmlns:s="https://beratung-franzke.de/web-tpl"
  xmlns:rss2="http://purl.org/rss/2.0/"
  xmlns:str="http://exslt.org/strings"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="rss2"
  extension-element-prefixes="str">

  <xsl:include href="xsl/layout.xsl" />

  <!-- Convert inline p-tags to spans, since there is not a
       consistent use of p in buchhalterservice's xml. -->
  <xsl:template match="p" mode="copy-description">
    <span>
      <xsl:apply-templates mode="copy-description"/>
    </span>
  </xsl:template>

  <xsl:template match="*" mode="copy-description">
    <xsl:element name="{local-name()}">
      <xsl:apply-templates mode="copy-description" select="@*|node()" />
    </xsl:element>
  </xsl:template>
  <xsl:template match="@*" mode="copy-description">
    <xsl:attribute name="{local-name()}">
      <xsl:value-of select="." />
    </xsl:attribute>
  </xsl:template>

  <xsl:template match="s:buchhalterservice" mode="html">
    <div class="news">
      <xsl:for-each select="document(@filename)/rss2:rss/rss2:channel/rss2:item">
        <xsl:variable name="i">
          <xsl:number />
        </xsl:variable>
        <xsl:if test="$i &lt;= 5">
          <div>
            <a href="{rss2:link}"><xsl:value-of select="rss2:title" /></a>
            <p>
              <xsl:apply-templates mode="copy-description" select="rss2:description/node()"/>
            </p>
          </div>
        </xsl:if>
      </xsl:for-each>
    </div>
  </xsl:template>

</xsl:stylesheet>