annotate html.xsl @ 41:afda541de4c4

working again with new refs
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 02 May 2017 10:00:02 +0100
parents 93fd0d532754
children 5b2333e59d91
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
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
7 <xsl:include href="n2a.xsl"/>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
8
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
9 <xsl:template match="/">
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
10 <html>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
11 <head>
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
12 <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
13 <style>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
14 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
15 td {padding: 0}
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
16 .e {color: red}
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
17 .formula {font-style: italic}
19
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 16
diff changeset
18 .reffed {border: solid 1px black}
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
19 table {table-layout: fixed}
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
20 th {width: 1en}
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
21 </style>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
22 </head>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
23 <body>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
24 <xsl:apply-templates/>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
25 </body>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
26 </html>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
27 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
28
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
29 <xsl:template match="e:a">
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
30 <xsl:variable name="n" select="count(e:r[1]/e:c)"/>
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
31 <table>
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
32 <thead>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
33 <tr>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
34 <xsl:for-each select="1 to $n">
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
35 <th/>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
36 </xsl:for-each>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
37 </tr>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
38 </thead>
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
39 <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
40 </table>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
41 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
42
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
43 <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
44 <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
45 <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
46 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
47
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
48 <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
49 <td>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
50 <xsl:choose>
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
51 <xsl:when test="e:t">
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
52 <xsl:attribute name="class">
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
53 <xsl:value-of select="(e:t,
19
9b1b169dc8db use refs, but broken: doesn't deal with ranges (false negs) or external refs (false pos), and not finding things it should (e.g. kenneth_lay X88)
Henry S. Thompson <ht@markup.co.uk>
parents: 16
diff changeset
54 if (@f) then 'formula' else (),
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
55 if (e:r) then 'reffed' else ())"/>
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
56 </xsl:attribute>
34
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
57 <xsl:attribute name="title"><xsl:value-of select="e:n2a(@c)"/><xsl:value-of select="../@r"/><xsl:if test="e:r">: <xsl:value-of select="e:r"/></xsl:if></xsl:attribute>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
58 <xsl:value-of select="if (e:t/@c) then e:t/@c else e:t"/></xsl:when>
93fd0d532754 fix bug in refs wrt e.g. [1]!.SGX,
Henry S. Thompson <ht@markup.co.uk>
parents: 20
diff changeset
59 <xsl:otherwise></xsl:otherwise>
15
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
60 </xsl:choose>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
61 </td>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
62 </xsl:template>
e767bef35bb9 default to ascii, but accept html.xsl for pretty
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
63 </xsl:stylesheet>