File: linearize-tables.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 (92 lines) | stat: -rw-r--r-- 2,131 bytes parent folder | download | duplicates (2)
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" ?>
<!--
Author: T. V. Raman <raman@cs.cornell.edu>
Copyright: (C) T. V. Raman, 2001 - 2002,   All Rights Reserved.
License: GPL
Description: Linearize tables.
Note that this loses structural information by turning each table cell
into a paragraph.
-->

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  <xsl:param name="base"/>
  <xsl:output method="html" indent="yes"
  encoding="iso8859-15"/>
  <xsl:include href="object.xsl"/>
  <xsl:include href="identity.xsl"/>
  <!-- {nuke these elements. --> 
  
  <xsl:template match="script|meta|link"/>
  
  <!-- } -->
  <!-- {listify tables --> 
  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="head">
    <head>
      <xsl:apply-templates select="title"/>
      <xsl:if test="string-length($base) &gt; 0">
        <xsl:element name="base">
          <xsl:attribute name="href">
            <xsl:value-of select="$base"/>
          </xsl:attribute>
        </xsl:element>
      </xsl:if>
    </head>
  </xsl:template>
  <xsl:template match="body">
    <xsl:element name="body">
      <xsl:apply-templates select="@*"/>
      <table>
        <caption>Tables Linearized</caption>
        <tr>
          <td>
            <a href="#__about_linearize_tables">About This
              Style
            </a>
          </td>
        </tr>
      </table>
      <xsl:apply-templates />
    </xsl:element>
    
    <h2>
      <a name="__about_linearize_tables">About This Style</a> 
    </h2>
    
    <p>
      Table contents are turned into a sequence of paragraphs, one per cell.
    </p>
  </xsl:template>
  
  <xsl:template match="table">
    <div class="table">
      <xsl:apply-templates/>
    </div>
  </xsl:template>
  
  <xsl:template match="tr">
    <hr/>
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="td">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>
  <!-- } -->
</xsl:stylesheet>

<!--
Local Variables:
mode: xae
sgml-indent-step: 2
sgml-indent-data: t
sgml-set-face: nil
sgml-insert-missing-element-comment: nil
folded-file: t
End:
-->