annotate html.xsl @ 16:2bbd067529b6

improve efficiency, detect blank rows, don't type empty cells
author Henry S. Thompson <ht@markup.co.uk>
date Mon, 03 Apr 2017 19:22:03 +0100
parents e767bef35bb9
children 9b1b169dc8db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
1 <?xml version='1.0'?>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
2 <!DOCTYPE doc SYSTEM "../../../lib/xml/xsl.dtd" >
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns:s="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="http://markup.co.uk/excel" exclude-result-prefixes="xs s xpf e" xmlns="http://www.w3.org/1999/xhtml" xmlns:xpf="http://www.w3.org/2005/xpath-functions">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
4 <xsl:strip-space elements="e:a"/>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
5 <xsl:output omit-xml-declaration="yes"/>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
6
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
7 <xsl:template match="/">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
8 <html>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
9 <head>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
10 <style>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
11 body {font-family: 'DejaVu Sans Mono' , monospace}
16
2bbd067529b6 improve efficiency, detect blank rows, don't type empty cells
Henry S. Thompson <ht@markup.co.uk>
parents: 15
diff changeset
12 td {padding: 0}
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
13 .e {color: red}
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
14 .formula {font-style: italic}
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
15 </style>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
16 </head>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
17 <body>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
18 <xsl:apply-templates/>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
19 </body>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
20 </html>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
21 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
22
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
23 <xsl:template match="e:a">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
24 <table>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
25 <thead/>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
26 <tbody><xsl:apply-templates/></tbody>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
27 </table>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
28 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
29
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
30 <xsl:template match="e:r">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
31 <tr><xsl:apply-templates/></tr>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
32 <xsl:text>&#10;</xsl:text>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
33 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
34
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
35 <xsl:template match="e:c">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
36 <td>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
37 <xsl:choose>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
38 <xsl:when test="text()">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
39 <xsl:attribute name="class">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
40 <xsl:value-of select="(.,if (@f) then 'formula' else ())"/>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
41 </xsl:attribute>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
42 <xsl:value-of select="."/></xsl:when>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
43 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
44 </xsl:choose>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
45 </td>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
46 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
47 </xsl:stylesheet>