File: atom.xsl

package info (click to toggle)
emacspeak 24-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,092 kB
  • ctags: 4,597
  • sloc: xml: 54,699; lisp: 42,103; tcl: 1,799; makefile: 810; cpp: 603; sh: 566; ansic: 153; perl: 124
file content (113 lines) | stat: -rw-r--r-- 3,605 bytes parent folder | download
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?xml version="1.0"?>
<!--
Author: T. V. Raman <raman@cs.cornell.edu>
Copyright: (C) T. V. Raman, 2001 - 2002,   All Rights Reserved.
License: GPL
View an Atom feed as clean HTML
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:atom="http://purl.org/atom/ns#"
                xmlns:w3a="http://www.w3.org/2005/Atom"
                xmlns:xhtml="http://www.w3.org/1999/xhtml"
                xmlns:gr="http://www.google.com/schemas/reader/atom/"
                version="1.0">
  <xsl:output encoding="iso8859-15" method="xml" indent="yes"/>
  
  <xsl:template match="atom:feed|w3a:feed">
    <html>
      <head>
        <title>
          <xsl:apply-templates select="atom:title|w3a:title"/>
          
        </title>
      </head>
      <body>
        <h1><xsl:value-of select="atom:title|w3a:title"/>
        <xsl:apply-templates
            select="atom:link[@rel='service.post']|w3a:link[@rel='service.post']"/>
        </h1>
        <h2>Table Of Contents</h2>
        <ol>
          <xsl:apply-templates select="atom:entry|w3a:entry" mode="toc"/>
        </ol>
        <xsl:apply-templates select="atom:entry|w3a:entry"/>
        <h2>
          <xsl:apply-templates select="atom:link[@rel='alternate']|w3a:link[@rel='alternate']"/>
        </h2>
        <p>
          <xsl:apply-templates select="atom:tagline|w3a:tagline"/>
          <xsl:apply-templates select="atom:author|w3a:author"/>
        </p>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template match="atom:entry|w3a:entry">
    <h2>
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="generate-id(.)"/> 
        </xsl:attribute>
        <xsl:attribute name="id"> <xsl:value-of select="generate-id(.)"/>
        </xsl:attribute>
        <xsl:apply-templates select="atom:title|w3a:title"/>
      </a>
      <xsl:apply-templates
          select="atom:link[@rel='service.edit']|w3a:link[@rel='service.edit']"/>
    </h2>
    <xsl:apply-templates select="atom:summary|atom:content|w3a:content|w3a:summary"/>
    <p>
      <xsl:apply-templates select="atom:link[@rel='alternate']|w3a:link[@rel='alternate']"/>
      <em><xsl:value-of  select="atom:author/atom:name"/>
      <xsl:value-of select="atom:issued|w3a:issued"/></em>
    </p>
  </xsl:template>
  <xsl:template match="atom:entry|w3a:entry" mode="toc">
    <li>
      <a>
        <xsl:attribute name="href">
          #<xsl:value-of select="generate-id(.)"/> 
        </xsl:attribute>
        <xsl:value-of select="atom:title|w3a:title"/>
      </a>
    </li>
  </xsl:template>
  <xsl:template
      match="atom:content|atom:summary|w3a:content|w3a:summary">
    <xsl:choose>
      <xsl:when test="@type='application/xhtml+xml'">
    <xsl:copy-of select="node()"/>
      </xsl:when>
<xsl:when test="@type='html' or @type='text/html'">
<xsl:value-of disable-output-escaping="yes"
    select="node()"/>
</xsl:when>
<!-- for legacy atom 0.3-->
<xsl:when test="@mode='escaped'">
<xsl:value-of disable-output-escaping="yes"
    select="node()"/>
</xsl:when>
    </xsl:choose>
  </xsl:template>
  <xsl:template match="xhtml:div">
    <xsl:copy/>
  </xsl:template>
  <xsl:template match="atom:link|w3a:link">
    <a>
      <xsl:attribute name="href">
        <xsl:value-of
            select="@href"/>
      </xsl:attribute>
      <xsl:choose>
        <xsl:when test="@rel='service.edit'">[Edit]</xsl:when>
        <xsl:when test="@rel='service.post'">[Post]</xsl:when>
        <xsl:otherwise>
          Bookmark:
        </xsl:otherwise>
      </xsl:choose>
    </a>
  </xsl:template>
  
  
  
</xsl:stylesheet>